mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-02-16 10:58:31 -05:00
Code cleanup
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
using System;
|
using ChrisKaczor.GenericSettingsProvider;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Windows.Threading;
|
|
||||||
using ChrisKaczor.Wpf.Application;
|
using ChrisKaczor.Wpf.Application;
|
||||||
using ChrisKaczor.GenericSettingsProvider;
|
|
||||||
using FeedCenter.Data;
|
using FeedCenter.Data;
|
||||||
using FeedCenter.Properties;
|
using FeedCenter.Properties;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace FeedCenter
|
namespace FeedCenter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -169,9 +169,9 @@ public static class LegacyDatabase
|
|||||||
|
|
||||||
var realm = Realm.GetInstance(realmConfiguration);
|
var realm = Realm.GetInstance(realmConfiguration);
|
||||||
|
|
||||||
if (!File.Exists(DatabaseFile))
|
if (!File.Exists(DatabaseFile))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using var connection = new SqlCeConnection($"Data Source={DatabaseFile}");
|
using var connection = new SqlCeConnection($"Data Source={DatabaseFile}");
|
||||||
|
|
||||||
connection.Open();
|
connection.Open();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Serilog;
|
using FeedCenter.Xml;
|
||||||
using System;
|
using Serilog;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using FeedCenter.Xml;
|
|
||||||
|
|
||||||
namespace FeedCenter.FeedParsers
|
namespace FeedCenter.FeedParsers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Serilog;
|
using FeedCenter.Xml;
|
||||||
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using FeedCenter.Xml;
|
|
||||||
|
|
||||||
namespace FeedCenter.FeedParsers
|
namespace FeedCenter.FeedParsers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using Realms;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Realms;
|
|
||||||
|
|
||||||
namespace FeedCenter
|
namespace FeedCenter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using ChrisKaczor.ApplicationUpdate;
|
using ChrisKaczor.ApplicationUpdate;
|
||||||
using FeedCenter.Data;
|
|
||||||
using FeedCenter.FeedParsers;
|
using FeedCenter.FeedParsers;
|
||||||
using FeedCenter.Properties;
|
using FeedCenter.Properties;
|
||||||
|
using FeedCenter.Xml;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using Realms;
|
using Realms;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
@@ -14,8 +15,6 @@ using System.Net.Http;
|
|||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using FeedCenter.Xml;
|
|
||||||
using Resources = FeedCenter.Properties.Resources;
|
using Resources = FeedCenter.Properties.Resources;
|
||||||
|
|
||||||
namespace FeedCenter
|
namespace FeedCenter
|
||||||
@@ -36,12 +35,6 @@ namespace FeedCenter
|
|||||||
Atom
|
Atom
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FeedItemComparison : byte
|
|
||||||
{
|
|
||||||
Default,
|
|
||||||
Title
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum FeedReadResult
|
public enum FeedReadResult
|
||||||
{
|
{
|
||||||
Success,
|
Success,
|
||||||
@@ -77,7 +70,6 @@ namespace FeedCenter
|
|||||||
public bool Authenticate { get; set; }
|
public bool Authenticate { get; set; }
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
public string Domain { get; set; }
|
|
||||||
|
|
||||||
private string LastReadResultRaw { get; set; }
|
private string LastReadResultRaw { get; set; }
|
||||||
|
|
||||||
@@ -89,14 +81,6 @@ namespace FeedCenter
|
|||||||
|
|
||||||
public DateTimeOffset LastUpdated { get; set; }
|
public DateTimeOffset LastUpdated { get; set; }
|
||||||
|
|
||||||
private string ItemComparisonRaw { get; set; }
|
|
||||||
|
|
||||||
public FeedItemComparison ItemComparison
|
|
||||||
{
|
|
||||||
get => Enum.TryParse(ItemComparisonRaw, out FeedItemComparison result) ? result : FeedItemComparison.Default;
|
|
||||||
set => ItemComparisonRaw = value.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
[MapTo("CategoryID")]
|
[MapTo("CategoryID")]
|
||||||
public Guid CategoryId { get; set; }
|
public Guid CategoryId { get; set; }
|
||||||
|
|
||||||
@@ -110,6 +94,7 @@ namespace FeedCenter
|
|||||||
|
|
||||||
public Category Category { get; set; }
|
public Category Category { get; set; }
|
||||||
|
|
||||||
|
[UsedImplicitly]
|
||||||
public IList<FeedItem> Items { get; }
|
public IList<FeedItem> Items { get; }
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global
|
// ReSharper disable once UnusedMember.Global
|
||||||
@@ -217,6 +202,9 @@ namespace FeedCenter
|
|||||||
// Get the feed text
|
// Get the feed text
|
||||||
var feedText = textReader.ReadToEnd();
|
var feedText = textReader.ReadToEnd();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(feedText))
|
||||||
|
return Tuple.Create(FeedReadResult.NoResponse, string.Empty);
|
||||||
|
|
||||||
// Get rid of any leading and trailing whitespace
|
// Get rid of any leading and trailing whitespace
|
||||||
feedText = feedText.Trim();
|
feedText = feedText.Trim();
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,6 @@
|
|||||||
Foreground="White"
|
Foreground="White"
|
||||||
nameBasedGrid:NameBasedGrid.Row="FeedListRow"
|
nameBasedGrid:NameBasedGrid.Row="FeedListRow"
|
||||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||||
<ListBoxItem Content="Test item" />
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<htmlTextBlock:HtmlTextBlock Html="{Binding}"
|
<htmlTextBlock:HtmlTextBlock Html="{Binding}"
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
using System;
|
using ChrisKaczor.ApplicationUpdate;
|
||||||
|
using ChrisKaczor.Wpf.Application;
|
||||||
|
using FeedCenter.Data;
|
||||||
|
using FeedCenter.Properties;
|
||||||
|
using Serilog;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using ChrisKaczor.Wpf.Application;
|
|
||||||
using ChrisKaczor.ApplicationUpdate;
|
|
||||||
using FeedCenter.Data;
|
|
||||||
using FeedCenter.Properties;
|
|
||||||
using Serilog;
|
|
||||||
|
|
||||||
namespace FeedCenter
|
namespace FeedCenter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using ChrisKaczor.InstalledBrowsers;
|
||||||
|
using ChrisKaczor.Wpf.Application;
|
||||||
|
using ChrisKaczor.Wpf.Validation;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using ChrisKaczor.Wpf.Application;
|
|
||||||
using ChrisKaczor.InstalledBrowsers;
|
|
||||||
using ChrisKaczor.Wpf.Validation;
|
|
||||||
|
|
||||||
internal class UserAgentItem
|
internal class UserAgentItem
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using FeedCenter.Data;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using FeedCenter.Data;
|
|
||||||
|
|
||||||
namespace FeedCenter.Options
|
namespace FeedCenter.Options
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using FeedCenter.Properties;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using FeedCenter.Properties;
|
|
||||||
|
|
||||||
namespace FeedCenter
|
namespace FeedCenter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,33 +42,33 @@ public class XmlSanitizingStream : StreamReader
|
|||||||
switch (xmlVersion)
|
switch (xmlVersion)
|
||||||
{
|
{
|
||||||
case "1.1": // http://www.w3.org/TR/xml11/#charsets
|
case "1.1": // http://www.w3.org/TR/xml11/#charsets
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
!(
|
!(
|
||||||
character <= 0x8 ||
|
character <= 0x8 ||
|
||||||
character == 0xB ||
|
character == 0xB ||
|
||||||
character == 0xC ||
|
character == 0xC ||
|
||||||
character is >= 0xE and <= 0x1F ||
|
character is >= 0xE and <= 0x1F ||
|
||||||
character is >= 0x7F and <= 0x84 ||
|
character is >= 0x7F and <= 0x84 ||
|
||||||
character is >= 0x86 and <= 0x9F ||
|
character is >= 0x86 and <= 0x9F ||
|
||||||
character > 0x10FFFF
|
character > 0x10FFFF
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case "1.0": // http://www.w3.org/TR/REC-xml/#charsets
|
case "1.0": // http://www.w3.org/TR/REC-xml/#charsets
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
character == 0x9 /* == '\t' == 9 */ ||
|
character == 0x9 /* == '\t' == 9 */ ||
|
||||||
character == 0xA /* == '\n' == 10 */ ||
|
character == 0xA /* == '\n' == 10 */ ||
|
||||||
character == 0xD /* == '\r' == 13 */ ||
|
character == 0xD /* == '\r' == 13 */ ||
|
||||||
character is >= 0x20 and <= 0xD7FF ||
|
character is >= 0x20 and <= 0xD7FF ||
|
||||||
character is >= 0xE000 and <= 0xFFFD ||
|
character is >= 0xE000 and <= 0xFFFD ||
|
||||||
character is >= 0x10000 and <= 0x10FFFF;
|
character is >= 0x10000 and <= 0x10FFFF;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException
|
throw new ArgumentOutOfRangeException
|
||||||
(nameof(xmlVersion), @$"'{xmlVersion}' is not a valid XML version.");
|
(nameof(xmlVersion), @$"'{xmlVersion}' is not a valid XML version.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user