diff --git a/src/Depressurizer.Core/AutoCats/AutoCatRule.cs b/src/Depressurizer.Core/AutoCats/AutoCatRule.cs new file mode 100644 index 00000000..e255d240 --- /dev/null +++ b/src/Depressurizer.Core/AutoCats/AutoCatRule.cs @@ -0,0 +1,14 @@ +using System.Xml.Serialization; + +namespace Depressurizer.Core.AutoCats +{ + public class AutoCatRule + { + #region Public Properties + + [XmlElement("Text")] + public string Name { get; set; } + + #endregion + } +} diff --git a/src/Depressurizer.Core/AutoCats/HoursPlayedRule.cs b/src/Depressurizer.Core/AutoCats/HoursPlayedRule.cs index fc8b9239..f5224b03 100644 --- a/src/Depressurizer.Core/AutoCats/HoursPlayedRule.cs +++ b/src/Depressurizer.Core/AutoCats/HoursPlayedRule.cs @@ -1,8 +1,6 @@ -using System.Xml.Serialization; - -namespace Depressurizer.Core.AutoCats +namespace Depressurizer.Core.AutoCats { - public sealed class HoursPlayedRule + public sealed class HoursPlayedRule : AutoCatRule { #region Constructors and Destructors @@ -39,9 +37,6 @@ public HoursPlayedRule(HoursPlayedRule other) /// public double MinHours { get; set; } - [XmlElement("Text")] - public string Name { get; set; } - #endregion } } diff --git a/src/Depressurizer.Core/AutoCats/HowLongToBeatRule.cs b/src/Depressurizer.Core/AutoCats/HowLongToBeatRule.cs index c6130586..baa2f071 100644 --- a/src/Depressurizer.Core/AutoCats/HowLongToBeatRule.cs +++ b/src/Depressurizer.Core/AutoCats/HowLongToBeatRule.cs @@ -1,9 +1,8 @@ -using System.Xml.Serialization; -using Depressurizer.Core.Enums; +using Depressurizer.Core.Enums; namespace Depressurizer.Core.AutoCats { - public sealed class HowLongToBeatRule + public sealed class HowLongToBeatRule : AutoCatRule { #region Constructors and Destructors @@ -42,9 +41,6 @@ public HowLongToBeatRule(HowLongToBeatRule other) /// public float MinHours { get; set; } - [XmlElement("Text")] - public string Name { get; set; } - public TimeType TimeType { get; set; } #endregion diff --git a/src/Depressurizer.Core/AutoCats/UserScoreRule.cs b/src/Depressurizer.Core/AutoCats/UserScoreRule.cs new file mode 100644 index 00000000..176df522 --- /dev/null +++ b/src/Depressurizer.Core/AutoCats/UserScoreRule.cs @@ -0,0 +1,44 @@ +namespace Depressurizer.Core.AutoCats +{ + public class UserScoreRule : AutoCatRule + { + #region Constructors and Destructors + + public UserScoreRule(string name, int minScore, int maxScore, int minReviews, int maxReviews) + { + Name = name; + MinScore = minScore; + MaxScore = maxScore; + MinReviews = minReviews; + MaxReviews = maxReviews; + } + + public UserScoreRule(UserScoreRule other) + { + Name = other.Name; + MinScore = other.MinScore; + MaxScore = other.MaxScore; + MinReviews = other.MinReviews; + MaxReviews = other.MaxReviews; + } + + /// + /// Parameter-less constructor for XmlSerializer. + /// + private UserScoreRule() { } + + #endregion + + #region Public Properties + + public int MaxReviews { get; set; } + + public int MaxScore { get; set; } + + public int MinReviews { get; set; } + + public int MinScore { get; set; } + + #endregion + } +} diff --git a/src/Depressurizer.Core/Helpers/Serialization.cs b/src/Depressurizer.Core/Helpers/Serialization.cs new file mode 100644 index 00000000..70bd42ec --- /dev/null +++ b/src/Depressurizer.Core/Helpers/Serialization.cs @@ -0,0 +1,35 @@ +namespace Depressurizer.Core.Helpers +{ + public static class Serialization + { + /// + /// Class containing common serialization constants. + /// + public static class Constants + { + #region Constants + + /// + /// Filter + /// + public const string Filter = "Filter"; + + /// + /// Name + /// + public const string Name = "Name"; + + /// + /// Prefix + /// + public const string Prefix = "Prefix"; + + /// + /// Rule + /// + public const string Rule = "Rule"; + + #endregion + } + } +} diff --git a/src/Depressurizer/AutoCat/AutoCat.cs b/src/Depressurizer/AutoCats/AutoCat.cs similarity index 98% rename from src/Depressurizer/AutoCat/AutoCat.cs rename to src/Depressurizer/AutoCats/AutoCat.cs index e0126e04..d470825b 100644 --- a/src/Depressurizer/AutoCat/AutoCat.cs +++ b/src/Depressurizer/AutoCats/AutoCat.cs @@ -8,7 +8,7 @@ using Depressurizer.Core.Models; using Depressurizer.Properties; -namespace Depressurizer +namespace Depressurizer.AutoCats { /// /// Abstract base class for autocategorization schemes. Call PreProcess before any set of autocat operations. @@ -219,14 +219,14 @@ public virtual void DeProcess() db = null; } - public virtual string GetProcessedString(string s) + public virtual string GetCategoryName(string name) { if (string.IsNullOrEmpty(Prefix)) { - return s; + return name; } - return Prefix + s; + return Prefix + name; } /// diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel.cs index 082073a0..860789f0 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; using Depressurizer.Core.Enums; -namespace Depressurizer +namespace Depressurizer.AutoCats { [TypeDescriptionProvider(typeof(InstantiableClassProvider))] public class AutoCatConfigPanel : UserControl diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Curator.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Curator.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Curator.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Curator.Designer.cs index 348b988a..0994a35f 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Curator.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Curator.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Curator { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Curator.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Curator.cs similarity index 98% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Curator.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Curator.cs index 2913630f..908ca527 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Curator.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Curator.cs @@ -2,7 +2,7 @@ using System.Windows.Forms; using Depressurizer.Core.Enums; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Curator : AutoCatConfigPanel { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Curator.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Curator.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Curator.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Curator.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_DevPub.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_DevPub.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_DevPub.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_DevPub.Designer.cs index 8cb37b1d..e734d097 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_DevPub.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_DevPub.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_DevPub { /// diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_DevPub.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_DevPub.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_DevPub.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_DevPub.cs index 6cebbc9f..548bdf07 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_DevPub.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_DevPub.cs @@ -3,7 +3,7 @@ using System.Threading; using System.Windows.Forms; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_DevPub : AutoCatConfigPanel { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_DevPub.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_DevPub.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_DevPub.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_DevPub.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Flags.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Flags.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Flags.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Flags.Designer.cs index e6305654..fd59104b 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Flags.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Flags.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Flags { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Flags.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Flags.cs similarity index 98% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Flags.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Flags.cs index ccdfb4ee..d13a4f4b 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Flags.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Flags.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Flags : AutoCatConfigPanel { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Flags.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Flags.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Flags.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Flags.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Genre.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Genre.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Genre.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Genre.Designer.cs index 246d6cf1..d1759d4e 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Genre.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Genre.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Genre { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Genre.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Genre.cs similarity index 98% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Genre.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Genre.cs index cb3b6ae9..d5e1cbef 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Genre.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Genre.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Forms; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Genre : AutoCatConfigPanel { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Genre.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Genre.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Genre.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Genre.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Group.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Group.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Group.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Group.Designer.cs index cd001693..37a52071 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Group.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Group.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Group { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Group.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Group.cs similarity index 89% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Group.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Group.cs index fa2d6887..a6277e72 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Group.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Group.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Windows.Forms; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Group : AutoCatConfigPanel { @@ -26,19 +26,26 @@ public AutoCatConfigPanel_Group(List autocats) #endregion - #region Public Methods and Operators + #region Public Properties - public List GetGroup() + public List Groups { - List group = new List(); - foreach (string name in lbAutocats.Items) + get { - group.Add(name); - } + List group = new List(); + foreach (string name in lbAutocats.Items) + { + group.Add(name); + } - return group; + return group; + } } + #endregion + + #region Public Methods and Operators + public override void LoadFromAutoCat(AutoCat autoCat) { AutoCatGroup ac = autoCat as AutoCatGroup; @@ -53,13 +60,12 @@ public override void LoadFromAutoCat(AutoCat autoCat) public override void SaveToAutoCat(AutoCat autoCat) { - AutoCatGroup ac = autoCat as AutoCatGroup; - if (ac == null) + if (!(autoCat is AutoCatGroup ac)) { return; } - ac.Autocats = GetGroup(); + ac.Autocats = Groups; } #endregion diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Group.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Group.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Group.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Group.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Hltb.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Hltb.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Hltb.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Hltb.Designer.cs index 0072e644..cb4e3ea1 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Hltb.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Hltb.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Hltb { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Hltb.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Hltb.cs similarity index 98% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Hltb.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Hltb.cs index 7d5a7553..dc66dcd2 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Hltb.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Hltb.cs @@ -5,7 +5,7 @@ using Depressurizer.Core.AutoCats; using Depressurizer.Core.Enums; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Hltb : AutoCatConfigPanel { @@ -69,7 +69,7 @@ public override void LoadFromAutoCat(AutoCat autoCat) txtPrefix.Text = acHltb.Prefix; chkIncludeUnknown.Checked = acHltb.IncludeUnknown; - txtUnknownText.Text = acHltb.UnknownText == null ? string.Empty : acHltb.UnknownText; + txtUnknownText.Text = acHltb.UnknownText ?? string.Empty; acHltb.IncludeUnknown = chkIncludeUnknown.Checked; acHltb.UnknownText = txtUnknownText.Text; diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Hltb.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Hltb.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Hltb.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Hltb.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_HoursPlayed.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_HoursPlayed.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_HoursPlayed.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_HoursPlayed.Designer.cs index 76071b90..b1b5b2ef 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_HoursPlayed.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_HoursPlayed.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_HoursPlayed { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_HoursPlayed.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_HoursPlayed.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_HoursPlayed.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_HoursPlayed.cs index 08cd2897..5957946d 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_HoursPlayed.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_HoursPlayed.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; using Depressurizer.Core.AutoCats; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_HoursPlayed : AutoCatConfigPanel { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_HoursPlayed.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_HoursPlayed.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_HoursPlayed.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_HoursPlayed.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Language.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Language.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Language.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Language.Designer.cs index 29d61393..427ea9e4 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Language.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Language.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Language { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Language.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Language.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Language.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Language.cs index b05d73d9..1a2d864a 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Language.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Language.cs @@ -2,7 +2,7 @@ using System.Windows.Forms; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Language : AutoCatConfigPanel { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Language.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Language.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Language.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Language.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Manual.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Manual.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Manual.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Manual.Designer.cs index c3ca45e7..1b87f418 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Manual.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Manual.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Manual { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Manual.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Manual.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Manual.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Manual.cs index 948c7ce3..8ee0e0b9 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Manual.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Manual.cs @@ -4,7 +4,7 @@ using System.Windows.Forms; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Manual : AutoCatConfigPanel { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Manual.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Manual.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Manual.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Manual.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Name.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Name.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Name.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Name.Designer.cs index e4bfb609..f84eb079 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Name.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Name.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Name { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Name.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Name.cs similarity index 92% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Name.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Name.cs index 2363e947..a25625f4 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Name.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Name.cs @@ -1,4 +1,4 @@ -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Name : AutoCatConfigPanel { @@ -22,7 +22,7 @@ public override void LoadFromAutoCat(AutoCat autoCat) return; } - txtPrefix.Text = acName.Prefix == null ? string.Empty : acName.Prefix; + txtPrefix.Text = acName.Prefix ?? string.Empty; cbSkipThe.Checked = acName.SkipThe; cbGroupNumbers.Checked = acName.GroupNumbers; chkgroupNonEnglishCharacters.Checked = acName.GroupNonEnglishCharacters; diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Name.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Name.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Name.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Name.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Platform.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Platform.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Platform.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Platform.Designer.cs index 376bf5b1..9a3724c0 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Platform.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Platform.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Platform { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Platform.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Platform.cs similarity index 92% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Platform.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Platform.cs index 3b7d7e23..02452d22 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Platform.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Platform.cs @@ -1,4 +1,4 @@ -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Platform : AutoCatConfigPanel { @@ -22,7 +22,7 @@ public override void LoadFromAutoCat(AutoCat autoCat) return; } - txtPrefix.Text = acPlatform.Prefix == null ? string.Empty : acPlatform.Prefix; + txtPrefix.Text = acPlatform.Prefix ?? string.Empty; chkboxPlatforms.SetItemChecked(0, acPlatform.Windows); chkboxPlatforms.SetItemChecked(1, acPlatform.Mac); chkboxPlatforms.SetItemChecked(2, acPlatform.Linux); diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Platform.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Platform.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Platform.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Platform.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Tags.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Tags.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Tags.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Tags.Designer.cs index e8a429c0..57f38278 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Tags.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Tags.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Tags { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Tags.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Tags.cs similarity index 98% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Tags.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Tags.cs index 47eccfb5..798c1cce 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Tags.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Tags.cs @@ -4,7 +4,7 @@ using System.Threading; using System.Windows.Forms; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Tags : AutoCatConfigPanel { @@ -97,7 +97,7 @@ public override void LoadFromAutoCat(AutoCat autoCat) return; } - txtPrefix.Text = ac.Prefix == null ? string.Empty : ac.Prefix; + txtPrefix.Text = ac.Prefix ?? string.Empty; numMaxTags.Value = ac.MaxTags; list_numMinScore.Value = ac.List_MinScore; diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Tags.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Tags.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Tags.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Tags.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_UserScore.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_UserScore.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_UserScore.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_UserScore.Designer.cs index 4af9faa9..e12f49fe 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_UserScore.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_UserScore.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_UserScore { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_UserScore.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_UserScore.cs similarity index 79% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_UserScore.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_UserScore.cs index 6e07b6fb..f9493086 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_UserScore.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_UserScore.cs @@ -2,9 +2,10 @@ using System.Collections.Generic; using System.ComponentModel; using System.Windows.Forms; +using Depressurizer.Core.AutoCats; using Depressurizer.Properties; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_UserScore : AutoCatConfigPanel { @@ -14,7 +15,7 @@ public partial class AutoCatConfigPanel_UserScore : AutoCatConfigPanel private readonly Dictionary presetMap = new Dictionary(); - private readonly BindingList ruleList = new BindingList(); + private readonly BindingList ruleList = new BindingList(); #endregion @@ -59,7 +60,7 @@ public AutoCatConfigPanel_UserScore() #region Delegates - public delegate void UserScorePresetDelegate(ICollection rules); + public delegate void UserScorePresetDelegate(ICollection rules); #endregion @@ -68,18 +69,18 @@ public AutoCatConfigPanel_UserScore() /// /// Generates rules that match the Steam Store rating labels /// - /// List of UserScore_Rule objects to populate with the new ones. Should generally be empty. - public void GenerateSteamRules(ICollection rules) + /// List of UserScoreRule objects to populate with the new ones. Should generally be empty. + public void GenerateSteamRules(ICollection rules) { - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive4, 95, 100, 500, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive3, 85, 100, 50, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive2, 80, 100, 1, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive1, 70, 79, 1, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Mixed, 40, 69, 1, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative1, 20, 39, 1, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative4, 0, 19, 500, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative3, 0, 19, 50, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative2, 0, 19, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive4, 95, 100, 500, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive3, 85, 100, 50, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive2, 80, 100, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive1, 70, 79, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Mixed, 40, 69, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative1, 20, 39, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative4, 0, 19, 500, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative3, 0, 19, 50, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative2, 0, 19, 1, 0)); } public override void LoadFromAutoCat(AutoCat autoCat) @@ -94,9 +95,9 @@ public override void LoadFromAutoCat(AutoCat autoCat) chkUseWilsonScore.Checked = acScore.UseWilsonScore; ruleList.Clear(); - foreach (UserScore_Rule rule in acScore.Rules) + foreach (UserScoreRule rule in acScore.Rules) { - ruleList.Add(new UserScore_Rule(rule)); + ruleList.Add(new UserScoreRule(rule)); } UpdateEnabledSettings(); @@ -112,7 +113,7 @@ public override void SaveToAutoCat(AutoCat autoCat) acScore.Prefix = txtPrefix.Text; acScore.UseWilsonScore = chkUseWilsonScore.Checked; - acScore.Rules = new List(ruleList); + acScore.Rules = new List(ruleList); } #endregion @@ -124,7 +125,7 @@ public override void SaveToAutoCat(AutoCat autoCat) /// private void AddRule() { - UserScore_Rule newRule = new UserScore_Rule(GlobalStrings.AutoCatUserScore_NewRuleName, 0, 100, 0, 0); + UserScoreRule newRule = new UserScoreRule(GlobalStrings.AutoCatUserScore_NewRuleName, 0, 100, 0, 0); ruleList.Add(newRule); lstRules.SelectedIndex = lstRules.Items.Count - 1; } @@ -193,7 +194,7 @@ private void MoveItem(int mainIndex, int offset, bool selectMoved) return; } - UserScore_Rule mainItem = ruleList[mainIndex]; + UserScoreRule mainItem = ruleList[mainIndex]; ruleList[mainIndex] = ruleList[alterIndex]; ruleList[alterIndex] = mainItem; if (selectMoved) diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_UserScore.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_UserScore.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_UserScore.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_UserScore.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_VRSupport.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_VRSupport.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_VRSupport.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_VRSupport.Designer.cs index c5b4f62c..e3a45b62 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_VRSupport.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_VRSupport.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_VrSupport { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_VRSupport.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_VRSupport.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_VRSupport.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_VRSupport.cs index 086534ef..967c06bd 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_VRSupport.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_VRSupport.cs @@ -2,7 +2,7 @@ using System.Windows.Forms; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_VrSupport : AutoCatConfigPanel { diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_VRSupport.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_VRSupport.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_VRSupport.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_VRSupport.resx diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Year.Designer.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Year.Designer.cs similarity index 99% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Year.Designer.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Year.Designer.cs index 7e9381c9..cf0daf59 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Year.Designer.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Year.Designer.cs @@ -1,4 +1,4 @@ -namespace Depressurizer { +namespace Depressurizer.AutoCats { partial class AutoCatConfigPanel_Year { /// /// Required designer variable. diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Year.cs b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Year.cs similarity index 90% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Year.cs rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Year.cs index 01622e5d..b1523df9 100644 --- a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Year.cs +++ b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Year.cs @@ -1,6 +1,6 @@ using Depressurizer.Core.Enums; -namespace Depressurizer +namespace Depressurizer.AutoCats { public partial class AutoCatConfigPanel_Year : AutoCatConfigPanel { @@ -25,9 +25,9 @@ public override void LoadFromAutoCat(AutoCat autoCat) return; } - txtPrefix.Text = acYear.Prefix == null ? string.Empty : acYear.Prefix; + txtPrefix.Text = acYear.Prefix ?? string.Empty; chkIncludeUnknown.Checked = acYear.IncludeUnknown; - txtUnknownText.Text = acYear.UnknownText == null ? string.Empty : acYear.UnknownText; + txtUnknownText.Text = acYear.UnknownText ?? string.Empty; switch (acYear.GroupingMode) { case AutoCatYearGrouping.Decade: diff --git a/src/Depressurizer/AutoCat/AutoCatConfigPanel_Year.resx b/src/Depressurizer/AutoCats/AutoCatConfigPanel_Year.resx similarity index 100% rename from src/Depressurizer/AutoCat/AutoCatConfigPanel_Year.resx rename to src/Depressurizer/AutoCats/AutoCatConfigPanel_Year.resx diff --git a/src/Depressurizer/AutoCat/AutoCatCurator.cs b/src/Depressurizer/AutoCats/AutoCatCurator.cs similarity index 93% rename from src/Depressurizer/AutoCat/AutoCatCurator.cs rename to src/Depressurizer/AutoCats/AutoCatCurator.cs index 82988d86..e75b2355 100644 --- a/src/Depressurizer/AutoCat/AutoCatCurator.cs +++ b/src/Depressurizer/AutoCats/AutoCatCurator.cs @@ -8,7 +8,7 @@ using Depressurizer.Core.Models; using Depressurizer.Properties; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatCurator : AutoCat { @@ -32,7 +32,7 @@ public AutoCatCurator(string name, string filter = null, string categoryName = n Filter = filter; CategoryName = categoryName; CuratorUrl = curatorUrl; - IncludedRecommendations = includedRecommendations == null ? new List() : includedRecommendations; + IncludedRecommendations = includedRecommendations ?? new List(); Selected = selected; } @@ -41,7 +41,7 @@ protected AutoCatCurator(AutoCatCurator other) : base(other) Filter = other.Filter; CategoryName = other.CategoryName; CuratorUrl = other.CuratorUrl; - IncludedRecommendations = other.IncludedRecommendations == null ? new List() : other.IncludedRecommendations; + IncludedRecommendations = other.IncludedRecommendations ?? new List(); Selected = other.Selected; } @@ -107,11 +107,13 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatCurator(this); } + /// public override void PreProcess(GameList games, Database db) { this.games = games; @@ -126,12 +128,12 @@ public override void PreProcess(GameList games, Database db) private string GetProcessedString(string type) { - if (!string.IsNullOrEmpty(CategoryName)) + if (string.IsNullOrEmpty(CategoryName)) { - return CategoryName.Replace("{type}", type); + return type; } - return type; + return CategoryName.Replace("{type}", type); } private void GetRecommendations() diff --git a/src/Depressurizer/AutoCat/AutoCatDevPub.cs b/src/Depressurizer/AutoCats/AutoCatDevPub.cs similarity index 85% rename from src/Depressurizer/AutoCat/AutoCatDevPub.cs rename to src/Depressurizer/AutoCats/AutoCatDevPub.cs index 26371e4c..23f1402c 100644 --- a/src/Depressurizer/AutoCat/AutoCatDevPub.cs +++ b/src/Depressurizer/AutoCats/AutoCatDevPub.cs @@ -8,7 +8,7 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { /// /// Autocategorization scheme that adds developer and publisher categories. @@ -17,10 +17,23 @@ public class AutoCatDevPub : AutoCat { #region Constants - // Serialization keys public const string TypeIdString = "AutoCatDevPub"; - private const string XmlName_Name = "Name", XmlName_Filter = "Filter", XmlName_AllDevelopers = "AllDevelopers", XmlName_AllPublishers = "AllPublishers", XmlName_Prefix = "Prefix", XmlName_OwnedOnly = "OwnedOnly", XmlName_MinCount = "MinCount", XmlName_Developers = "Developers", XmlName_Developer = "Developer", XmlName_Publishers = "Publishers", XmlName_Publisher = "Publisher"; + private const string XmlName_AllDevelopers = "AllDevelopers"; + + private const string XmlName_AllPublishers = "AllPublishers"; + + private const string XmlName_Developer = "Developer"; + + private const string XmlName_Developers = "Developers"; + + private const string XmlName_MinCount = "MinCount"; + + private const string XmlName_OwnedOnly = "OwnedOnly"; + + private const string XmlName_Publisher = "Publisher"; + + private const string XmlName_Publishers = "Publishers"; #endregion @@ -48,8 +61,8 @@ public AutoCatDevPub(string name, string filter = null, string prefix = null, bo MinCount = count; AllDevelopers = developersAll; AllPublishers = publishersAll; - Developers = developers == null ? new List() : developers; - Publishers = publishers == null ? new List() : publishers; + Developers = developers ?? new List(); + Publishers = publishers ?? new List(); Selected = selected; } @@ -78,6 +91,7 @@ protected AutoCatDevPub(AutoCatDevPub other) : base(other) public bool AllPublishers { get; set; } + /// public override AutoCatType AutoCatType => AutoCatType.DevPub; [XmlArrayItem("Developer")] @@ -87,8 +101,6 @@ protected AutoCatDevPub(AutoCatDevPub other) : base(other) public bool OwnedOnly { get; set; } - public string Prefix { get; set; } - [XmlArrayItem("Publisher")] public List Publishers { get; set; } @@ -106,11 +118,11 @@ protected AutoCatDevPub(AutoCatDevPub other) : base(other) public static AutoCatDevPub LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); bool AllDevelopers = XmlUtil.GetBoolFromNode(xElement[XmlName_AllDevelopers], false); bool AllPublishers = XmlUtil.GetBoolFromNode(xElement[XmlName_AllPublishers], false); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], null); bool owned = XmlUtil.GetBoolFromNode(xElement[XmlName_OwnedOnly], false); int count = XmlUtil.GetIntFromNode(xElement[XmlName_MinCount], 0); @@ -148,6 +160,7 @@ public static AutoCatDevPub LoadFromXmlElement(XmlElement xElement) return result; } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -188,7 +201,7 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) if (DevCount(developer) >= MinCount) { - game.AddCategory(games.GetCategory(GetProcessedString(developer))); + game.AddCategory(games.GetCategory(GetCategoryName(developer))); } } @@ -202,18 +215,20 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) if (PubCount(publisher) >= MinCount) { - game.AddCategory(games.GetCategory(GetProcessedString(publisher))); + game.AddCategory(games.GetCategory(GetCategoryName(publisher))); } } return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatDevPub(this); } + /// public override void DeProcess() { base.DeProcess(); @@ -236,15 +251,15 @@ public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteElementString(XmlName_OwnedOnly, OwnedOnly.ToString().ToLowerInvariant()); @@ -286,16 +301,6 @@ private int DevCount(string name) return devList.Where(dev => dev.Key == name).Select(dev => dev.Value).FirstOrDefault(); } - private string GetProcessedString(string baseString) - { - if (string.IsNullOrEmpty(Prefix)) - { - return baseString; - } - - return Prefix + baseString; - } - private int PubCount(string name) { return pubList.Where(pub => pub.Key == name).Select(pub => pub.Value).FirstOrDefault(); diff --git a/src/Depressurizer/AutoCat/AutoCatFlags.cs b/src/Depressurizer/AutoCats/AutoCatFlags.cs similarity index 80% rename from src/Depressurizer/AutoCat/AutoCatFlags.cs rename to src/Depressurizer/AutoCats/AutoCatFlags.cs index a36b0cb8..97788e66 100644 --- a/src/Depressurizer/AutoCat/AutoCatFlags.cs +++ b/src/Depressurizer/AutoCats/AutoCatFlags.cs @@ -8,16 +8,17 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatFlags : AutoCat { #region Constants - // Serialization constants public const string TypeIdString = "AutoCatFlags"; - private const string XmlName_Name = "Name", XmlName_Filter = "Filter", XmlName_Prefix = "Prefix", XmlName_FlagList = "Flags", XmlName_Flag = "Flag"; + private const string XmlName_Flag = "Flag"; + + private const string XmlName_FlagList = "Flags"; #endregion @@ -46,15 +47,13 @@ protected AutoCatFlags(AutoCatFlags other) : base(other) #region Public Properties + /// public override AutoCatType AutoCatType => AutoCatType.Flags; [XmlArray("Flags")] [XmlArrayItem("Flag")] public List IncludedFlags { get; set; } - // AutoCat configuration - public string Prefix { get; set; } - #endregion #region Properties @@ -67,9 +66,9 @@ protected AutoCatFlags(AutoCatFlags other) : base(other) public static AutoCatFlags LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], null); List flags = new List(); XmlElement flagListElement = xElement[XmlName_FlagList]; @@ -79,6 +78,11 @@ public static AutoCatFlags LoadFromXmlElement(XmlElement xElement) } XmlNodeList flagElements = flagListElement.SelectNodes(XmlName_Flag); + if (flagElements == null) + { + return new AutoCatFlags(name, filter, prefix, flags); + } + foreach (XmlNode n in flagElements) { if (XmlUtil.TryGetStringFromNode(n, out string flag)) @@ -90,6 +94,7 @@ public static AutoCatFlags LoadFromXmlElement(XmlElement xElement) return new AutoCatFlags(name, filter, prefix, flags); } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -125,31 +130,33 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) foreach (string catString in categories) { - Category c = games.GetCategory(GetProcessedString(catString)); + Category c = games.GetCategory(GetCategoryName(catString)); game.AddCategory(c); } return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatFlags(this); } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteStartElement(XmlName_FlagList); @@ -164,19 +171,5 @@ public override void WriteToXml(XmlWriter writer) } #endregion - - #region Methods - - private string GetProcessedString(string baseString) - { - if (string.IsNullOrEmpty(Prefix)) - { - return baseString; - } - - return Prefix + baseString; - } - - #endregion } } diff --git a/src/Depressurizer/AutoCat/AutoCatGenre.cs b/src/Depressurizer/AutoCats/AutoCatGenre.cs similarity index 84% rename from src/Depressurizer/AutoCat/AutoCatGenre.cs rename to src/Depressurizer/AutoCats/AutoCatGenre.cs index 3f897b52..e780e8a3 100644 --- a/src/Depressurizer/AutoCat/AutoCatGenre.cs +++ b/src/Depressurizer/AutoCats/AutoCatGenre.cs @@ -7,7 +7,7 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { /// /// Autocategorization scheme that adds genre categories. @@ -16,12 +16,19 @@ public class AutoCatGenre : AutoCat { #region Constants - // Serialization keys public const string TypeIdString = "AutoCatGenre"; private const int MAX_PARENT_DEPTH = 3; - private const string XmlName_Name = "Name", XmlName_Filter = "Filter", XmlName_RemOther = "RemoveOthers", XmlName_TagFallback = "TagFallback", XmlName_MaxCats = "MaxCategories", XmlName_Prefix = "Prefix", XmlName_IgnoreList = "Ignored", XmlName_IgnoreItem = "Ignore"; + private const string XmlName_IgnoreItem = "Ignore"; + + private const string XmlName_IgnoreList = "Ignored"; + + private const string XmlName_MaxCats = "MaxCategories"; + + private const string XmlName_RemOther = "RemoveOthers"; + + private const string XmlName_TagFallback = "TagFallback"; #endregion @@ -50,7 +57,7 @@ public AutoCatGenre(string name, string filter = null, string prefix = null, int RemoveOtherGenres = removeOthers; TagFallback = tagFallback; Prefix = prefix; - IgnoredGenres = ignore == null ? new List() : ignore; + IgnoredGenres = ignore ?? new List(); Selected = selected; } @@ -81,8 +88,6 @@ protected AutoCatGenre(AutoCatGenre other) : base(other) // Autocat configuration public int MaxCategories { get; set; } - public string Prefix { get; set; } - [XmlElement("RemoveOthers")] public bool RemoveOtherGenres { get; set; } @@ -100,19 +105,19 @@ protected AutoCatGenre(AutoCatGenre other) : base(other) public static AutoCatGenre LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); int maxCats = XmlUtil.GetIntFromNode(xElement[XmlName_MaxCats], 0); bool remOther = XmlUtil.GetBoolFromNode(xElement[XmlName_RemOther], false); bool tagFallback = XmlUtil.GetBoolFromNode(xElement[XmlName_TagFallback], true); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], null); List ignore = new List(); XmlElement ignoreListElement = xElement[XmlName_IgnoreList]; - if (ignoreListElement != null) + XmlNodeList ignoreNodes = ignoreListElement?.SelectNodes(XmlName_IgnoreItem); + if (ignoreNodes != null) { - XmlNodeList ignoreNodes = ignoreListElement.SelectNodes(XmlName_IgnoreItem); foreach (XmlNode node in ignoreNodes) { if (XmlUtil.TryGetStringFromNode(node, out string s)) @@ -126,6 +131,7 @@ public static AutoCatGenre LoadFromXmlElement(XmlElement xElement) return result; } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -169,7 +175,7 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (!IgnoredGenres.Contains(genreList[i])) { - categories.Add(games.GetCategory(GetProcessedString(genreList[i]))); + categories.Add(games.GetCategory(GetCategoryName(genreList[i]))); } else { @@ -182,11 +188,13 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatGenre(this); } + /// public override void DeProcess() { base.DeProcess(); @@ -216,19 +224,20 @@ public override void PreProcess(GameList games, Database db) } } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteElementString(XmlName_MaxCats, MaxCategories.ToString()); @@ -248,19 +257,5 @@ public override void WriteToXml(XmlWriter writer) } #endregion - - #region Methods - - private string GetProcessedString(string baseString) - { - if (string.IsNullOrEmpty(Prefix)) - { - return baseString; - } - - return Prefix + baseString; - } - - #endregion } } diff --git a/src/Depressurizer/AutoCat/AutoCatGroup.cs b/src/Depressurizer/AutoCats/AutoCatGroup.cs similarity index 84% rename from src/Depressurizer/AutoCat/AutoCatGroup.cs rename to src/Depressurizer/AutoCats/AutoCatGroup.cs index 97767072..cdd25c73 100644 --- a/src/Depressurizer/AutoCat/AutoCatGroup.cs +++ b/src/Depressurizer/AutoCats/AutoCatGroup.cs @@ -6,7 +6,7 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatGroup : AutoCat { @@ -15,7 +15,9 @@ public class AutoCatGroup : AutoCat // Serialization strings public const string TypeIdString = "AutoCatGroup"; - public const string XmlName_Name = "Name", XmlName_Filter = "Filter", XmlName_Autocats = "Autocats", XmlName_Autocat = "Autocat"; + public const string XmlName_Autocat = "Autocat"; + + public const string XmlName_Autocats = "Autocats"; #endregion @@ -24,7 +26,7 @@ public class AutoCatGroup : AutoCat public AutoCatGroup(string name, string filter = null, List autocats = null, bool selected = false) : base(name) { Filter = filter; - Autocats = autocats == null ? new List() : autocats; + Autocats = autocats ?? new List(); Selected = selected; } @@ -46,9 +48,10 @@ protected AutoCatGroup(AutoCatGroup other) : base(other) [XmlArrayItem("Autocat")] public List Autocats { get; set; } - // Meta properies + /// public override AutoCatType AutoCatType => AutoCatType.Group; + /// public override string DisplayName { get @@ -75,13 +78,14 @@ public override string DisplayName public static AutoCatGroup LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); List autocats = XmlUtil.GetStringsFromNodeList(xElement.SelectNodes(XmlName_Autocats + "/" + XmlName_Autocat)); return new AutoCatGroup(name, filter, autocats); } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -115,19 +119,21 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatGroup(this); } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Autocats != null && Autocats.Count > 0) diff --git a/src/Depressurizer/AutoCat/AutoCatHltb.cs b/src/Depressurizer/AutoCats/AutoCatHltb.cs similarity index 88% rename from src/Depressurizer/AutoCat/AutoCatHltb.cs rename to src/Depressurizer/AutoCats/AutoCatHltb.cs index fed28d96..8528ed4d 100644 --- a/src/Depressurizer/AutoCat/AutoCatHltb.cs +++ b/src/Depressurizer/AutoCats/AutoCatHltb.cs @@ -7,7 +7,7 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatHltb : AutoCat { @@ -15,16 +15,8 @@ public class AutoCatHltb : AutoCat public const string TypeIdString = "AutoCatHltb"; - public const string XmlName_Filter = "Filter"; - public const string XmlName_IncludeUnknown = "IncludeUnknown"; - public const string XmlName_Name = "Name"; - - public const string XmlName_Prefix = "Prefix"; - - public const string XmlName_Rule = "Rule"; - public const string XmlName_Rule_MaxHours = "MaxHours"; public const string XmlName_Rule_MinHours = "MinHours"; @@ -80,8 +72,6 @@ public AutoCatHltb(AutoCatHltb other) : base(other) public bool IncludeUnknown { get; set; } - public string Prefix { get; set; } - public string UnknownText { get; set; } #endregion @@ -96,13 +86,13 @@ public AutoCatHltb(AutoCatHltb other) : base(other) public static AutoCatHltb LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], string.Empty); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], string.Empty); bool includeUnknown = XmlUtil.GetBoolFromNode(xElement[XmlName_IncludeUnknown], false); string unknownText = XmlUtil.GetStringFromNode(xElement[XmlName_UnknownText], string.Empty); - XmlNodeList rulesNodeList = xElement.SelectNodes(XmlName_Rule); + XmlNodeList rulesNodeList = xElement.SelectNodes(Serialization.Constants.Rule); List rules = new List(); if (rulesNodeList != null) { @@ -204,24 +194,26 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatHltb(this); } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteElementString(XmlName_IncludeUnknown, IncludeUnknown.ToString().ToLowerInvariant()); @@ -229,7 +221,7 @@ public override void WriteToXml(XmlWriter writer) foreach (HowLongToBeatRule rule in Rules) { - writer.WriteStartElement(XmlName_Rule); + writer.WriteStartElement(Serialization.Constants.Rule); writer.WriteElementString(XmlName_Rule_Text, rule.Name); writer.WriteElementString(XmlName_Rule_MinHours, rule.MinHours.ToString()); writer.WriteElementString(XmlName_Rule_MaxHours, rule.MaxHours.ToString()); @@ -271,16 +263,6 @@ private static bool CheckRule(HowLongToBeatRule rule, float hltbMain, float hltb return hours >= rule.MinHours && (hours <= rule.MaxHours || rule.MaxHours == 0.0f); } - private string GetCategoryName(string name) - { - if (string.IsNullOrWhiteSpace(Prefix)) - { - return name; - } - - return Prefix + name; - } - #endregion } } diff --git a/src/Depressurizer/AutoCat/AutoCatHoursPlayed.cs b/src/Depressurizer/AutoCats/AutoCatHoursPlayed.cs similarity index 85% rename from src/Depressurizer/AutoCat/AutoCatHoursPlayed.cs rename to src/Depressurizer/AutoCats/AutoCatHoursPlayed.cs index 279a7d46..afcf7f47 100644 --- a/src/Depressurizer/AutoCat/AutoCatHoursPlayed.cs +++ b/src/Depressurizer/AutoCats/AutoCatHoursPlayed.cs @@ -8,7 +8,7 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatHoursPlayed : AutoCat { @@ -16,16 +16,8 @@ public class AutoCatHoursPlayed : AutoCat public const string TypeIdString = "AutoCatHoursPlayed"; - public const string XmlName_Filter = "Filter"; - public const string XmlName_IncludeUnknown = "IncludeUnknown"; - public const string XmlName_Name = "Name"; - - public const string XmlName_Prefix = "Prefix"; - - public const string XmlName_Rule = "Rule"; - public const string XmlName_Rule_MaxHours = "MaxHours"; public const string XmlName_Rule_MinHours = "MinHours"; @@ -87,12 +79,12 @@ public AutoCatHoursPlayed(AutoCatHoursPlayed other) : base(other) public static AutoCatHoursPlayed LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], string.Empty); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], string.Empty); bool includeUnknown = XmlUtil.GetBoolFromNode(xElement[XmlName_IncludeUnknown], false); - XmlNodeList rulesNodeList = xElement.SelectNodes(XmlName_Rule); + XmlNodeList rulesNodeList = xElement.SelectNodes(Serialization.Constants.Rule); List rules = new List(); if (rulesNodeList != null) { @@ -180,22 +172,22 @@ public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteElementString(XmlName_IncludeUnknown, IncludeUnknown.ToString().ToLowerInvariant()); foreach (HoursPlayedRule rule in Rules) { - writer.WriteStartElement(XmlName_Rule); + writer.WriteStartElement(Serialization.Constants.Rule); writer.WriteElementString(XmlName_Rule_Text, rule.Name); writer.WriteElementString(XmlName_Rule_MinHours, rule.MinHours.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString(XmlName_Rule_MaxHours, rule.MaxHours.ToString(CultureInfo.InvariantCulture)); @@ -225,16 +217,6 @@ private static bool CheckRule(HoursPlayedRule rule, double hours) return Math.Abs(rule.MaxHours) < 0.01; } - private string GetCategoryName(string name) - { - if (string.IsNullOrEmpty(Prefix)) - { - return name; - } - - return Prefix + name; - } - #endregion } } diff --git a/src/Depressurizer/AutoCat/AutoCatLanguage.cs b/src/Depressurizer/AutoCats/AutoCatLanguage.cs similarity index 89% rename from src/Depressurizer/AutoCat/AutoCatLanguage.cs rename to src/Depressurizer/AutoCats/AutoCatLanguage.cs index 5e9fb771..8fd3047b 100644 --- a/src/Depressurizer/AutoCat/AutoCatLanguage.cs +++ b/src/Depressurizer/AutoCats/AutoCatLanguage.cs @@ -6,17 +6,14 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatLanguage : AutoCat { #region Constants - // Serialization constants public const string TypeIdString = "AutoCatLanguage"; - private const string XmlNameFilter = "Filter"; - private const string XmlNameFullAudioList = "FullAudio"; private const string XmlNameIncludeTypePrefix = "IncludeTypePrefix"; @@ -25,10 +22,6 @@ public class AutoCatLanguage : AutoCat private const string XmlNameLanguage = "Langauge"; - private const string XmlNameName = "Name"; - - private const string XmlNamePrefix = "Prefix"; - private const string XmlNameSubtitlesList = "Subtitles"; private const string XmlNameTypeFallback = "TypeFallback"; @@ -73,6 +66,7 @@ protected AutoCatLanguage(AutoCatLanguage other) : base(other) #region Public Properties + /// public override AutoCatType AutoCatType => AutoCatType.Language; public LanguageSupport IncludedLanguages @@ -83,9 +77,6 @@ public LanguageSupport IncludedLanguages public bool IncludeTypePrefix { get; set; } - // AutoCat configuration - public string Prefix { get; set; } - public bool TypeFallback { get; set; } #endregion @@ -100,9 +91,9 @@ public LanguageSupport IncludedLanguages public static AutoCatLanguage LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlNameName], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlNameFilter], null); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlNamePrefix], null); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], null); bool includeTypePrefix = XmlUtil.GetBoolFromNode(xElement[XmlNameIncludeTypePrefix], false); bool typeFallback = XmlUtil.GetBoolFromNode(xElement[XmlNameTypeFallback], false); List interfaceList = new List(); @@ -140,15 +131,17 @@ public static AutoCatLanguage LoadFromXmlElement(XmlElement xElement) } XmlNodeList fullAudioElements = fullAudio?.SelectNodes(XmlNameLanguage); - if (fullAudioElements != null) + if (fullAudioElements == null) + { + return new AutoCatLanguage(name, filter, prefix, includeTypePrefix, typeFallback, interfaceList, subtitlesList, fullAudioList); + } + + for (int i = 0; i < fullAudioElements.Count; i++) { - for (int i = 0; i < fullAudioElements.Count; i++) + XmlNode n = fullAudioElements[i]; + if (XmlUtil.TryGetStringFromNode(n, out string language)) { - XmlNode n = fullAudioElements[i]; - if (XmlUtil.TryGetStringFromNode(n, out string language)) - { - fullAudioList.Add(language); - } + fullAudioList.Add(language); } } @@ -217,24 +210,26 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatLanguage(this); } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlNameName, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlNameFilter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlNamePrefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteElementString(XmlNameIncludeTypePrefix, IncludeTypePrefix.ToString().ToLowerInvariant()); diff --git a/src/Depressurizer/AutoCat/AutoCatManual.cs b/src/Depressurizer/AutoCats/AutoCatManual.cs similarity index 78% rename from src/Depressurizer/AutoCat/AutoCatManual.cs rename to src/Depressurizer/AutoCats/AutoCatManual.cs index 50aa0a73..75b6358e 100644 --- a/src/Depressurizer/AutoCat/AutoCatManual.cs +++ b/src/Depressurizer/AutoCats/AutoCatManual.cs @@ -6,7 +6,7 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { /// /// Autocategorization scheme that adds and removes manual categories. @@ -15,10 +15,17 @@ public class AutoCatManual : AutoCat { #region Constants - // Serialization keys public const string TypeIdString = "AutoCatManual"; - private const string XmlName_Name = "Name", XmlName_Filter = "Filter", XmlName_RemoveAll = "RemoveAll", XmlName_Prefix = "Prefix", XmlName_RemoveList = "Remove", XmlName_RemoveItem = "Category", XmlName_AddList = "Add", XmlName_AddItem = "Category"; + private const string XmlName_AddItem = "Category"; + + private const string XmlName_AddList = "Add"; + + private const string XmlName_RemoveAll = "RemoveAll"; + + private const string XmlName_RemoveItem = "Category"; + + private const string XmlName_RemoveList = "Remove"; #endregion @@ -39,8 +46,8 @@ public AutoCatManual(string name, string filter = null, string prefix = null, bo Filter = filter; Prefix = prefix; RemoveAllCategories = removeAll; - RemoveCategories = remove == null ? new List() : remove; - AddCategories = add == null ? new List() : add; + RemoveCategories = remove ?? new List(); + AddCategories = add ?? new List(); Selected = selected; } @@ -65,10 +72,9 @@ protected AutoCatManual(AutoCatManual other) : base(other) [XmlArrayItem("Category")] public List AddCategories { get; set; } + /// public override AutoCatType AutoCatType => AutoCatType.Manual; - public string Prefix { get; set; } - // Autocat configuration [XmlElement("RemoveAll")] public bool RemoveAllCategories { get; set; } @@ -89,17 +95,17 @@ protected AutoCatManual(AutoCatManual other) : base(other) public static AutoCatManual LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); bool removeAll = XmlUtil.GetBoolFromNode(xElement[XmlName_RemoveAll], false); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], null); List remove = new List(); XmlElement removeListElement = xElement[XmlName_RemoveList]; - if (removeListElement != null) + XmlNodeList removeNodes = removeListElement?.SelectNodes(XmlName_RemoveItem); + if (removeNodes != null) { - XmlNodeList removeNodes = removeListElement.SelectNodes(XmlName_RemoveItem); foreach (XmlNode node in removeNodes) { if (XmlUtil.TryGetStringFromNode(node, out string s)) @@ -112,9 +118,9 @@ public static AutoCatManual LoadFromXmlElement(XmlElement xElement) List add = new List(); XmlElement addListElement = xElement[XmlName_AddList]; - if (addListElement != null) + XmlNodeList addNodes = addListElement?.SelectNodes(XmlName_AddItem); + if (addNodes != null) { - XmlNodeList addNodes = addListElement.SelectNodes(XmlName_AddItem); foreach (XmlNode node in addNodes) { if (XmlUtil.TryGetStringFromNode(node, out string s)) @@ -128,6 +134,7 @@ public static AutoCatManual LoadFromXmlElement(XmlElement xElement) return result; } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -169,11 +176,13 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) foreach (string category in RemoveCategories) { Category c = gamelist.GetCategory(category); - if (game.ContainsCategory(c)) + if (!game.ContainsCategory(c)) { - game.RemoveCategory(c); - removed.Add(c); + continue; } + + game.RemoveCategory(c); + removed.Add(c); } foreach (Category c in removed) @@ -185,23 +194,27 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) } } - if (AddCategories != null) + if (AddCategories == null) { - foreach (string category in AddCategories) - // add Category, or create it if it doesn't exist - { - game.AddCategory(gamelist.GetCategory(GetProcessedString(category))); - } + return AutoCatResult.Success; + } + + foreach (string category in AddCategories) + // add Category, or create it if it doesn't exist + { + game.AddCategory(gamelist.GetCategory(GetCategoryName(category))); } return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatManual(this); } + /// public override void DeProcess() { base.DeProcess(); @@ -218,19 +231,20 @@ public override void PreProcess(GameList games, Database db) gamelist = games; } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteElementString(XmlName_RemoveAll, RemoveAllCategories.ToString().ToLowerInvariant()); @@ -255,19 +269,5 @@ public override void WriteToXml(XmlWriter writer) } #endregion - - #region Methods - - private string GetProcessedString(string baseString) - { - if (string.IsNullOrEmpty(Prefix)) - { - return baseString; - } - - return Prefix + baseString; - } - - #endregion } } diff --git a/src/Depressurizer/AutoCat/AutoCatName.cs b/src/Depressurizer/AutoCats/AutoCatName.cs similarity index 90% rename from src/Depressurizer/AutoCat/AutoCatName.cs rename to src/Depressurizer/AutoCats/AutoCatName.cs index 7425247f..10b923f9 100644 --- a/src/Depressurizer/AutoCat/AutoCatName.cs +++ b/src/Depressurizer/AutoCats/AutoCatName.cs @@ -5,7 +5,7 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatName : AutoCat { @@ -19,10 +19,6 @@ public class AutoCatName : AutoCat public const string XmlName_GroupNumbers = "GroupNumbers"; - public const string XmlName_Name = "Name"; - - public const string XmlName_Prefix = "Prefix"; - public const string XmlName_SkipThe = "SkipThe"; #endregion @@ -46,6 +42,7 @@ public AutoCatName(string name, string prefix = "", bool skipThe = true, bool gr #region Public Properties + /// public override AutoCatType AutoCatType => AutoCatType.Name; public bool GroupNonEnglishCharacters { get; set; } @@ -54,8 +51,6 @@ public AutoCatName(string name, string prefix = "", bool skipThe = true, bool gr public bool GroupNumbers { get; set; } - public string Prefix { get; set; } - public bool SkipThe { get; set; } #endregion @@ -70,8 +65,8 @@ public AutoCatName(string name, string prefix = "", bool skipThe = true, bool gr public static AutoCatName LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], null); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], null); bool skipThe = XmlUtil.GetBoolFromNode(xElement[XmlName_SkipThe], true); bool groupNumbers = XmlUtil.GetBoolFromNode(xElement[XmlName_GroupNumbers], true); bool groupNonEnglishCharacters = XmlUtil.GetBoolFromNode(xElement[XmlName_GroupNonEnglishCharacters], false); @@ -80,6 +75,7 @@ public static AutoCatName LoadFromXmlElement(XmlElement xElement) return new AutoCatName(name, prefix, skipThe, groupNumbers, groupNonEnglishCharacters, groupNonEnglishCharactersText); } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -131,17 +127,19 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatName(Name, Prefix, SkipThe, GroupNumbers, GroupNonEnglishCharacters, GroupNonEnglishCharactersText); } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Name, Name); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); writer.WriteElementString(XmlName_SkipThe, SkipThe.ToString().ToLowerInvariant()); writer.WriteElementString(XmlName_GroupNumbers, GroupNumbers.ToString().ToLowerInvariant()); writer.WriteElementString(XmlName_GroupNonEnglishCharacters, GroupNonEnglishCharacters.ToString().ToLowerInvariant()); diff --git a/src/Depressurizer/AutoCat/AutoCatPlatform.cs b/src/Depressurizer/AutoCats/AutoCatPlatform.cs similarity index 89% rename from src/Depressurizer/AutoCat/AutoCatPlatform.cs rename to src/Depressurizer/AutoCats/AutoCatPlatform.cs index 36312f2c..196b9986 100644 --- a/src/Depressurizer/AutoCat/AutoCatPlatform.cs +++ b/src/Depressurizer/AutoCats/AutoCatPlatform.cs @@ -3,7 +3,7 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatPlatform : AutoCat { @@ -95,22 +95,22 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) AppPlatforms platforms = entry.Platforms; if (Windows && platforms.HasFlag(AppPlatforms.Windows)) { - game.AddCategory(games.GetCategory(GetProcessedString("Windows"))); + game.AddCategory(games.GetCategory(GetCategoryName("Windows"))); } if (Mac && platforms.HasFlag(AppPlatforms.Mac)) { - game.AddCategory(games.GetCategory(GetProcessedString("Mac"))); + game.AddCategory(games.GetCategory(GetCategoryName("Mac"))); } if (Linux && platforms.HasFlag(AppPlatforms.Linux)) { - game.AddCategory(games.GetCategory(GetProcessedString("Linux"))); + game.AddCategory(games.GetCategory(GetCategoryName("Linux"))); } if (Linux && platforms.HasFlag(AppPlatforms.Linux)) { - game.AddCategory(games.GetCategory(GetProcessedString("SteamOS"))); + game.AddCategory(games.GetCategory(GetCategoryName("SteamOS"))); } return AutoCatResult.Success; diff --git a/src/Depressurizer/AutoCat/AutoCatTags.cs b/src/Depressurizer/AutoCats/AutoCatTags.cs similarity index 83% rename from src/Depressurizer/AutoCat/AutoCatTags.cs rename to src/Depressurizer/AutoCats/AutoCatTags.cs index a66024d8..5e92a8fa 100644 --- a/src/Depressurizer/AutoCat/AutoCatTags.cs +++ b/src/Depressurizer/AutoCats/AutoCatTags.cs @@ -7,7 +7,7 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatTags : AutoCat { @@ -15,7 +15,23 @@ public class AutoCatTags : AutoCat public const string TypeIdString = "AutoCatTags"; - private const string XmlName_Name = "Name", XmlName_Filter = "Filter", XmlName_Prefix = "Prefix", XmlName_TagList = "Tags", XmlName_Tag = "Tag", XmlName_MaxTags = "MaxTags", XmlName_ListOwnedOnly = "List_OwnedOnly", XmlName_ListWeightFactor = "List_WeightedScore", XmlName_ListMinScore = "List_MinScore", XmlName_ListTagsPerGame = "List_TagsPerGame", XmlName_ListExcludeGenres = "List_ExcludeGenres", XmlName_ListScoreSort = "List_ScoreSort"; + private const string XmlName_ListExcludeGenres = "List_ExcludeGenres"; + + private const string XmlName_ListMinScore = "List_MinScore"; + + private const string XmlName_ListOwnedOnly = "List_OwnedOnly"; + + private const string XmlName_ListScoreSort = "List_ScoreSort"; + + private const string XmlName_ListTagsPerGame = "List_TagsPerGame"; + + private const string XmlName_ListWeightFactor = "List_WeightedScore"; + + private const string XmlName_MaxTags = "MaxTags"; + + private const string XmlName_Tag = "Tag"; + + private const string XmlName_TagList = "Tags"; #endregion @@ -26,14 +42,7 @@ public AutoCatTags(string name, string filter = null, string prefix = null, Hash Filter = filter; Prefix = prefix; - if (tags == null) - { - IncludedTags = new HashSet(); - } - else - { - IncludedTags = tags; - } + IncludedTags = tags ?? new HashSet(); MaxTags = maxTags; List_OwnedOnly = listOwnedOnly; @@ -68,6 +77,7 @@ protected AutoCatTags(AutoCatTags other) : base(other) #region Public Properties + /// public override AutoCatType AutoCatType => AutoCatType.Tags; [XmlArray("Tags")] @@ -88,8 +98,6 @@ protected AutoCatTags(AutoCatTags other) : base(other) public int MaxTags { get; set; } - public string Prefix { get; set; } - #endregion #region Properties @@ -102,14 +110,14 @@ protected AutoCatTags(AutoCatTags other) : base(other) public static AutoCatTags LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); AutoCatTags result = new AutoCatTags(name) { - Filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null) + Filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null) }; - if (XmlUtil.TryGetStringFromNode(xElement[XmlName_Prefix], out string prefix)) + if (XmlUtil.TryGetStringFromNode(xElement[Serialization.Constants.Prefix], out string prefix)) { result.Prefix = prefix; } @@ -155,6 +163,7 @@ public static AutoCatTags LoadFromXmlElement(XmlElement xElement) return result; } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -195,41 +204,33 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) continue; } - game.AddCategory(games.GetCategory(GetProcessedString(gameTags[index]))); + game.AddCategory(games.GetCategory(GetCategoryName(gameTags[index]))); added++; } return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatTags(this); } - public string GetProcessedString(string s) - { - if (string.IsNullOrEmpty(Prefix)) - { - return s; - } - - return Prefix + s; - } - + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteElementString(XmlName_MaxTags, MaxTags.ToString()); diff --git a/src/Depressurizer/AutoCat/AutoCatUserScore.cs b/src/Depressurizer/AutoCats/AutoCatUserScore.cs similarity index 55% rename from src/Depressurizer/AutoCat/AutoCatUserScore.cs rename to src/Depressurizer/AutoCats/AutoCatUserScore.cs index 6318b455..cad501bb 100644 --- a/src/Depressurizer/AutoCat/AutoCatUserScore.cs +++ b/src/Depressurizer/AutoCats/AutoCatUserScore.cs @@ -2,80 +2,48 @@ using System.Collections.Generic; using System.Xml; using System.Xml.Serialization; +using Depressurizer.Core.AutoCats; using Depressurizer.Core.Enums; using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { - public class UserScore_Rule + public class AutoCatUserScore : AutoCat { - #region Constructors and Destructors - - public UserScore_Rule(string name, int minScore, int maxScore, int minReviews, int maxReviews) - { - Name = name; - MinScore = minScore; - MaxScore = maxScore; - MinReviews = minReviews; - MaxReviews = maxReviews; - } - - public UserScore_Rule(UserScore_Rule other) - { - Name = other.Name; - MinScore = other.MinScore; - MaxScore = other.MaxScore; - MinReviews = other.MinReviews; - MaxReviews = other.MaxReviews; - } - - //XmlSerializer requires a parameterless constructor - private UserScore_Rule() { } - - #endregion - - #region Public Properties - - public int MaxReviews { get; set; } - - public int MaxScore { get; set; } + #region Constants - public int MinReviews { get; set; } + public const string TypeIdString = "AutoCatUserScore"; - public int MinScore { get; set; } + public const string XmlName_Rule_MaxReviews = "MaxReviews"; - [XmlElement("Text")] - public string Name { get; set; } + public const string XmlName_Rule_MaxScore = "MaxScore"; - #endregion - } + public const string XmlName_Rule_MinReviews = "MinReviews"; - public class AutoCatUserScore : AutoCat - { - #region Constants + public const string XmlName_Rule_MinScore = "MinScore"; - public const string TypeIdString = "AutoCatUserScore"; + public const string XmlName_Rule_Text = "Text"; - public const string XmlName_Name = "Name", XmlName_Filter = "Filter", XmlName_Prefix = "Prefix", XmlName_UseWilsonScore = "UseWilsonScore", XmlName_Rule = "Rule", XmlName_Rule_Text = "Text", XmlName_Rule_MinScore = "MinScore", XmlName_Rule_MaxScore = "MaxScore", XmlName_Rule_MinReviews = "MinReviews", XmlName_Rule_MaxReviews = "MaxReviews"; + public const string XmlName_UseWilsonScore = "UseWilsonScore"; #endregion #region Fields [XmlElement("Rule")] - public List Rules; + public List Rules; #endregion #region Constructors and Destructors - public AutoCatUserScore(string name, string filter = null, string prefix = null, bool useWilsonScore = false, List rules = null, bool selected = false) : base(name) + public AutoCatUserScore(string name, string filter = null, string prefix = null, bool useWilsonScore = false, List rules = null, bool selected = false) : base(name) { Filter = filter; Prefix = prefix; UseWilsonScore = useWilsonScore; - Rules = rules == null ? new List() : rules; + Rules = rules ?? new List(); Selected = selected; } @@ -84,7 +52,7 @@ public AutoCatUserScore(AutoCatUserScore other) : base(other) Filter = other.Filter; Prefix = other.Prefix; UseWilsonScore = other.UseWilsonScore; - Rules = other.Rules.ConvertAll(rule => new UserScore_Rule(rule)); + Rules = other.Rules.ConvertAll(rule => new UserScoreRule(rule)); Selected = other.Selected; } @@ -95,10 +63,9 @@ public AutoCatUserScore(AutoCatUserScore other) : base(other) #region Public Properties + /// public override AutoCatType AutoCatType => AutoCatType.UserScore; - public string Prefix { get; set; } - public bool UseWilsonScore { get; set; } #endregion @@ -113,29 +80,35 @@ public AutoCatUserScore(AutoCatUserScore other) : base(other) public static AutoCatUserScore LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], string.Empty); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], string.Empty); bool useWilsonScore = XmlUtil.GetBoolFromNode(xElement[XmlName_UseWilsonScore], false); - List rules = new List(); - foreach (XmlNode node in xElement.SelectNodes(XmlName_Rule)) + List rules = new List(); + XmlNodeList nodeList = xElement.SelectNodes(Serialization.Constants.Rule); + if (nodeList != null) { - string ruleName = XmlUtil.GetStringFromNode(node[XmlName_Rule_Text], string.Empty); - int ruleMin = XmlUtil.GetIntFromNode(node[XmlName_Rule_MinScore], 0); - int ruleMax = XmlUtil.GetIntFromNode(node[XmlName_Rule_MaxScore], 100); - int ruleMinRev = XmlUtil.GetIntFromNode(node[XmlName_Rule_MinReviews], 0); - int ruleMaxRev = XmlUtil.GetIntFromNode(node[XmlName_Rule_MaxReviews], 0); - rules.Add(new UserScore_Rule(ruleName, ruleMin, ruleMax, ruleMinRev, ruleMaxRev)); + foreach (XmlNode node in nodeList) + { + string ruleName = XmlUtil.GetStringFromNode(node[XmlName_Rule_Text], string.Empty); + int ruleMin = XmlUtil.GetIntFromNode(node[XmlName_Rule_MinScore], 0); + int ruleMax = XmlUtil.GetIntFromNode(node[XmlName_Rule_MaxScore], 100); + int ruleMinRev = XmlUtil.GetIntFromNode(node[XmlName_Rule_MinReviews], 0); + int ruleMaxRev = XmlUtil.GetIntFromNode(node[XmlName_Rule_MaxReviews], 0); + rules.Add(new UserScoreRule(ruleName, ruleMin, ruleMax, ruleMinRev, ruleMaxRev)); + } } AutoCatUserScore result = new AutoCatUserScore(name, filter, prefix, useWilsonScore) { Rules = rules }; + return result; } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -188,24 +161,29 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) } string result = null; - foreach (UserScore_Rule rule in Rules) + foreach (UserScoreRule rule in Rules) { - if (CheckRule(rule, score, reviews)) + if (!CheckRule(rule, score, reviews)) { - result = rule.Name; - break; + continue; } + + result = rule.Name; + break; } - if (result != null) + if (result == null) { - result = GetProcessedString(result); - game.AddCategory(games.GetCategory(result)); + return AutoCatResult.Success; } + result = GetCategoryName(result); + game.AddCategory(games.GetCategory(result)); + return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatUserScore(this); @@ -214,40 +192,41 @@ public override AutoCat Clone() /// /// Generates rules that match the Steam Store rating labels /// - /// List of UserScore_Rule objects to populate with the new ones. Should generally be empty. - public void GenerateSteamRules(ICollection rules) + /// List of UserScoreRule objects to populate with the new ones. Should generally be empty. + public void GenerateSteamRules(ICollection rules) { - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive4, 95, 100, 500, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive3, 85, 100, 50, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive2, 80, 100, 1, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive1, 70, 79, 1, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Mixed, 40, 69, 1, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative1, 20, 39, 1, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative4, 0, 19, 500, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative3, 0, 19, 50, 0)); - rules.Add(new UserScore_Rule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative2, 0, 19, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive4, 95, 100, 500, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive3, 85, 100, 50, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive2, 80, 100, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Positive1, 70, 79, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Mixed, 40, 69, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative1, 20, 39, 1, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative4, 0, 19, 500, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative3, 0, 19, 50, 0)); + rules.Add(new UserScoreRule(GlobalStrings.AutoCatUserScore_Preset_Steam_Negative2, 0, 19, 1, 0)); } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteElementString(XmlName_UseWilsonScore, UseWilsonScore.ToString().ToLowerInvariant()); - foreach (UserScore_Rule rule in Rules) + foreach (UserScoreRule rule in Rules) { - writer.WriteStartElement(XmlName_Rule); + writer.WriteStartElement(Serialization.Constants.Rule); writer.WriteElementString(XmlName_Rule_Text, rule.Name); writer.WriteElementString(XmlName_Rule_MinScore, rule.MinScore.ToString()); writer.WriteElementString(XmlName_Rule_MaxScore, rule.MaxScore.ToString()); @@ -264,21 +243,11 @@ public override void WriteToXml(XmlWriter writer) #region Methods - private bool CheckRule(UserScore_Rule rule, int score, int reviews) + private static bool CheckRule(UserScoreRule rule, int score, int reviews) { return score >= rule.MinScore && score <= rule.MaxScore && rule.MinReviews <= reviews && (rule.MaxReviews == 0 || rule.MaxReviews >= reviews); } - private string GetProcessedString(string s) - { - if (!string.IsNullOrEmpty(Prefix)) - { - return Prefix + s; - } - - return s; - } - #endregion } } diff --git a/src/Depressurizer/AutoCat/AutoCatVrSupport.cs b/src/Depressurizer/AutoCats/AutoCatVrSupport.cs similarity index 81% rename from src/Depressurizer/AutoCat/AutoCatVrSupport.cs rename to src/Depressurizer/AutoCats/AutoCatVrSupport.cs index a24b71f3..6ceee7b0 100644 --- a/src/Depressurizer/AutoCat/AutoCatVrSupport.cs +++ b/src/Depressurizer/AutoCats/AutoCatVrSupport.cs @@ -6,29 +6,22 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatVrSupport : AutoCat { #region Constants - // Serialization constants public const string TypeIdString = "AutoCatVrSupport"; - private const string XmlNameFilter = "Filter"; - private const string XmlNameFlag = "Flag"; private const string XmlNameHeadsetsList = "Headsets"; private const string XmlNameInputList = "Input"; - private const string XmlNameName = "Name"; - private const string XmlNamePlayAreaList = "PlayArea"; - private const string XmlNamePrefix = "Prefix"; - #endregion #region Fields @@ -65,6 +58,7 @@ protected AutoCatVrSupport(AutoCatVrSupport other) : base(other) #region Public Properties + /// public override AutoCatType AutoCatType => AutoCatType.VrSupport; public VRSupport IncludedVRSupportFlags @@ -73,9 +67,6 @@ public VRSupport IncludedVRSupportFlags set => _includedVrSupportFlags = value; } - // AutoCat configuration - public string Prefix { get; set; } - #endregion #region Properties @@ -88,9 +79,9 @@ public VRSupport IncludedVRSupportFlags public static AutoCatVrSupport LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlNameName], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlNameFilter], null); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlNamePrefix], null); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], null); List headsetsList = new List(); List inputList = new List(); List playAreaList = new List(); @@ -126,21 +117,24 @@ public static AutoCatVrSupport LoadFromXmlElement(XmlElement xElement) } XmlNodeList playAreaElements = playArea?.SelectNodes(XmlNameFlag); - if (playAreaElements != null) + if (playAreaElements == null) + { + return new AutoCatVrSupport(name, filter, prefix, headsetsList, inputList, playAreaList); + } + + for (int i = 0; i < playAreaElements.Count; i++) { - for (int i = 0; i < playAreaElements.Count; i++) + XmlNode n = playAreaElements[i]; + if (XmlUtil.TryGetStringFromNode(n, out string flag)) { - XmlNode n = playAreaElements[i]; - if (XmlUtil.TryGetStringFromNode(n, out string flag)) - { - playAreaList.Add(flag); - } + playAreaList.Add(flag); } } return new AutoCatVrSupport(name, filter, prefix, headsetsList, inputList, playAreaList); } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -183,43 +177,45 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) foreach (string catString in headsets) { - Category c = games.GetCategory(GetProcessedString(catString)); + Category c = games.GetCategory(GetCategoryName(catString)); game.AddCategory(c); } foreach (string catString in input) { - Category c = games.GetCategory(GetProcessedString(catString)); + Category c = games.GetCategory(GetCategoryName(catString)); game.AddCategory(c); } foreach (string catString in playArea) { - Category c = games.GetCategory(GetProcessedString(catString)); + Category c = games.GetCategory(GetCategoryName(catString)); game.AddCategory(c); } return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatVrSupport(this); } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlNameName, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlNameFilter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlNamePrefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteStartElement(XmlNameHeadsetsList); @@ -252,19 +248,5 @@ public override void WriteToXml(XmlWriter writer) } #endregion - - #region Methods - - private string GetProcessedString(string baseString) - { - if (string.IsNullOrEmpty(Prefix)) - { - return baseString; - } - - return Prefix + baseString; - } - - #endregion } } diff --git a/src/Depressurizer/AutoCat/AutoCatYear.cs b/src/Depressurizer/AutoCats/AutoCatYear.cs similarity index 84% rename from src/Depressurizer/AutoCat/AutoCatYear.cs rename to src/Depressurizer/AutoCats/AutoCatYear.cs index 2ca55cd2..6a95a07a 100644 --- a/src/Depressurizer/AutoCat/AutoCatYear.cs +++ b/src/Depressurizer/AutoCats/AutoCatYear.cs @@ -4,16 +4,19 @@ using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; -namespace Depressurizer +namespace Depressurizer.AutoCats { public class AutoCatYear : AutoCat { #region Constants - // Serialization strings public const string TypeIdString = "AutoCatYear"; - public const string XmlName_Name = "Name", XmlName_Filter = "Filter", XmlName_Prefix = "Prefix", XmlName_IncludeUnknown = "IncludeUnknown", XmlName_UnknownText = "UnknownText", XmlName_GroupingMode = "GroupingMode"; + public const string XmlName_GroupingMode = "GroupingMode"; + + public const string XmlName_IncludeUnknown = "IncludeUnknown"; + + public const string XmlName_UnknownText = "UnknownText"; #endregion @@ -46,16 +49,13 @@ protected AutoCatYear(AutoCatYear other) : base(other) #region Public Properties - // Meta properies + /// public override AutoCatType AutoCatType => AutoCatType.Year; public AutoCatYearGrouping GroupingMode { get; set; } public bool IncludeUnknown { get; set; } - // Autocat configuration properties - public string Prefix { get; set; } - public string UnknownText { get; set; } #endregion @@ -70,9 +70,9 @@ protected AutoCatYear(AutoCatYear other) : base(other) public static AutoCatYear LoadFromXmlElement(XmlElement xElement) { - string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString); - string filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null); - string prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null); + string name = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Name], TypeIdString); + string filter = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Filter], null); + string prefix = XmlUtil.GetStringFromNode(xElement[Serialization.Constants.Prefix], null); bool includeUnknown = XmlUtil.GetBoolFromNode(xElement[XmlName_IncludeUnknown], true); string unknownText = XmlUtil.GetStringFromNode(xElement[XmlName_UnknownText], null); AutoCatYearGrouping groupMode = XmlUtil.GetEnumFromNode(xElement[XmlName_GroupingMode], AutoCatYearGrouping.None); @@ -80,6 +80,7 @@ public static AutoCatYear LoadFromXmlElement(XmlElement xElement) return new AutoCatYear(name, filter, prefix, includeUnknown, unknownText, groupMode); } + /// public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) { if (games == null) @@ -119,24 +120,26 @@ public override AutoCatResult CategorizeGame(GameInfo game, Filter filter) return AutoCatResult.Success; } + /// public override AutoCat Clone() { return new AutoCatYear(this); } + /// public override void WriteToXml(XmlWriter writer) { writer.WriteStartElement(TypeIdString); - writer.WriteElementString(XmlName_Name, Name); + writer.WriteElementString(Serialization.Constants.Name, Name); if (Filter != null) { - writer.WriteElementString(XmlName_Filter, Filter); + writer.WriteElementString(Serialization.Constants.Filter, Filter); } if (Prefix != null) { - writer.WriteElementString(XmlName_Prefix, Prefix); + writer.WriteElementString(Serialization.Constants.Prefix, Prefix); } writer.WriteElementString(XmlName_IncludeUnknown, IncludeUnknown.ToString().ToLowerInvariant()); @@ -150,6 +153,12 @@ public override void WriteToXml(XmlWriter writer) #region Methods + private static string GetRangeString(int year, int rangeSize) + { + int first = year - year % rangeSize; + return $"{first}-{first + rangeSize - 1}"; + } + private string GetProcessedString(int year) { string result; @@ -181,12 +190,6 @@ private string GetProcessedString(int year) return Prefix + result; } - private string GetRangeString(int year, int rangeSize) - { - int first = year - year % rangeSize; - return $"{first}-{first + rangeSize - 1}"; - } - #endregion } } diff --git a/src/Depressurizer/AutoCat/CDlgCurator.cs b/src/Depressurizer/AutoCats/CDlgCurator.cs similarity index 99% rename from src/Depressurizer/AutoCat/CDlgCurator.cs rename to src/Depressurizer/AutoCats/CDlgCurator.cs index 86756cbf..d4421a03 100644 --- a/src/Depressurizer/AutoCat/CDlgCurator.cs +++ b/src/Depressurizer/AutoCats/CDlgCurator.cs @@ -9,7 +9,7 @@ using Newtonsoft.Json.Linq; using Rallion; -namespace Depressurizer +namespace Depressurizer.AutoCats { internal class GetCuratorRecommendationsDlg : CancelableDlg { diff --git a/src/Depressurizer/AutomaticModeForm.cs b/src/Depressurizer/AutomaticModeForm.cs index 69d15899..09e0456f 100644 --- a/src/Depressurizer/AutomaticModeForm.cs +++ b/src/Depressurizer/AutomaticModeForm.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Windows.Forms; using System.Xml.XPath; +using Depressurizer.AutoCats; using Depressurizer.Core.Enums; using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; diff --git a/src/Depressurizer/Depressurizer.csproj b/src/Depressurizer/Depressurizer.csproj index fa4b2362..747bfe0d 100644 --- a/src/Depressurizer/Depressurizer.csproj +++ b/src/Depressurizer/Depressurizer.csproj @@ -120,120 +120,120 @@ - + UserControl - + AutoCatConfigPanel_HoursPlayed.cs - + - + UserControl - + AutoCatConfigPanel_Curator.cs - + UserControl - + AutoCatConfigPanel_Platform.cs - - - - + + + + UserControl - + UserControl - + AutoCatConfigPanel_Language.cs - + UserControl - + AutoCatConfigPanel_VrSupport.cs - + UserControl - + AutoCatConfigPanel_Flags.cs - + UserControl - + AutoCatConfigPanel_DevPub.cs - + UserControl - + AutoCatConfigPanel_Group.cs - + UserControl - + AutoCatConfigPanel_Manual.cs - + UserControl - + AutoCatConfigPanel_Genre.cs - + UserControl - + AutoCatConfigPanel_Name.cs - + UserControl - + AutoCatConfigPanel_Tags.cs - + UserControl - + AutoCatConfigPanel_Hltb.cs - + UserControl - + AutoCatConfigPanel_UserScore.cs - + UserControl - + AutoCatConfigPanel_Year.cs - - - - - - - - - - - - - + + + + + + + + + + + + + Form @@ -402,49 +402,49 @@ Form - + AutoCatConfigPanel_Curator.cs - + AutoCatConfigPanel_HoursPlayed.cs - + AutoCatConfigPanel_Language.cs - + AutoCatConfigPanel_Platform.cs - + AutoCatConfigPanel_VrSupport.cs - + AutoCatConfigPanel_Flags.cs - + AutoCatConfigPanel_DevPub.cs - + AutoCatConfigPanel_Group.cs - + AutoCatConfigPanel_Manual.cs - + AutoCatConfigPanel_Genre.cs - + AutoCatConfigPanel_Name.cs - + AutoCatConfigPanel_Tags.cs - + AutoCatConfigPanel_Hltb.cs - + AutoCatConfigPanel_UserScore.cs - + AutoCatConfigPanel_Year.cs diff --git a/src/Depressurizer/DlgAutoCat.cs b/src/Depressurizer/DlgAutoCat.cs index bd4db302..7f20a804 100644 --- a/src/Depressurizer/DlgAutoCat.cs +++ b/src/Depressurizer/DlgAutoCat.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Windows.Forms; +using Depressurizer.AutoCats; using Depressurizer.Core.Enums; using Rallion; diff --git a/src/Depressurizer/DlgAutoCatSelect.cs b/src/Depressurizer/DlgAutoCatSelect.cs index 283f7d82..8c6bb213 100644 --- a/src/Depressurizer/DlgAutoCatSelect.cs +++ b/src/Depressurizer/DlgAutoCatSelect.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Windows.Forms; +using Depressurizer.AutoCats; using Depressurizer.Core.Enums; namespace Depressurizer diff --git a/src/Depressurizer/DlgAutomaticModeHelper.cs b/src/Depressurizer/DlgAutomaticModeHelper.cs index 8fd30cf3..b260854d 100644 --- a/src/Depressurizer/DlgAutomaticModeHelper.cs +++ b/src/Depressurizer/DlgAutomaticModeHelper.cs @@ -1,6 +1,7 @@ using System; using System.Text; using System.Windows.Forms; +using Depressurizer.AutoCats; using IWshRuntimeLibrary; namespace Depressurizer diff --git a/src/Depressurizer/FodyWeavers.xsd b/src/Depressurizer/FodyWeavers.xsd index 44a53744..6ea0ffa7 100644 --- a/src/Depressurizer/FodyWeavers.xsd +++ b/src/Depressurizer/FodyWeavers.xsd @@ -1,4 +1,5 @@  + diff --git a/src/Depressurizer/Lib/DlgGetString.cs b/src/Depressurizer/Lib/DlgGetString.cs index 5d32ab34..44eb969b 100644 --- a/src/Depressurizer/Lib/DlgGetString.cs +++ b/src/Depressurizer/Lib/DlgGetString.cs @@ -21,18 +21,20 @@ public GetStringDlg(string initialValue = "", string title = "Enter value", stri public string AcceptButtonText { - set => cmdOk.Text = value == null ? string.Empty : value; + get => cmdOk.Text; + set => cmdOk.Text = value ?? string.Empty; } public string LabelText { - set => lblValue.Text = value == null ? string.Empty : value; + get => lblValue.Text; + set => lblValue.Text = value ?? string.Empty; } public string Value { get => txtValue.Text; - set => txtValue.Text = value == null ? string.Empty : value; + set => txtValue.Text = value ?? string.Empty; } #endregion diff --git a/src/Depressurizer/MainForm.cs b/src/Depressurizer/MainForm.cs index 5d44d575..34734390 100644 --- a/src/Depressurizer/MainForm.cs +++ b/src/Depressurizer/MainForm.cs @@ -15,6 +15,7 @@ using System.Threading; using System.Windows.Forms; using BrightIdeasSoftware; +using Depressurizer.AutoCats; using Depressurizer.Core.Enums; using Depressurizer.Core.Helpers; using Depressurizer.Core.Models; diff --git a/src/Depressurizer/Profile.cs b/src/Depressurizer/Profile.cs index 49d71ea4..74fcf038 100644 --- a/src/Depressurizer/Profile.cs +++ b/src/Depressurizer/Profile.cs @@ -3,6 +3,7 @@ using System.Drawing; using System.Globalization; using System.Xml; +using Depressurizer.AutoCats; using Depressurizer.Core.AutoCats; using Depressurizer.Core.Enums; using Depressurizer.Core.Helpers; diff --git a/src/Depressurizer/ProfileAccessException.cs b/src/Depressurizer/ProfileAccessException.cs index e446a09f..631bfba0 100644 --- a/src/Depressurizer/ProfileAccessException.cs +++ b/src/Depressurizer/ProfileAccessException.cs @@ -2,6 +2,7 @@ namespace Depressurizer { + [Serializable] internal class ProfileAccessException : ApplicationException { #region Constructors and Destructors diff --git a/src/Depressurizer/packages.config b/src/Depressurizer/packages.config index 57403178..3a78cc4b 100644 --- a/src/Depressurizer/packages.config +++ b/src/Depressurizer/packages.config @@ -1,4 +1,5 @@  +