diff --git a/NetTally/Quest.cs b/NetTally/Quest.cs index 818b4473..aa6042ec 100644 --- a/NetTally/Quest.cs +++ b/NetTally/Quest.cs @@ -11,7 +11,7 @@ namespace NetTally /// public class Quest : IQuest, INotifyPropertyChanged { - static Regex urlRegex = new Regex(@"^(http://forums.sufficientvelocity.com/threads/)?(?[^/]+)(/.*)?"); + static readonly Regex urlRegex = new Regex(@"^(http://forums.sufficientvelocity.com/threads/)?(?[^/]+)(/.*)?"); /// /// Empty constructor for XML serialization. diff --git a/NetTally/Quests.cs b/NetTally/Quests.cs index 86c1b4f7..47c6206c 100644 --- a/NetTally/Quests.cs +++ b/NetTally/Quests.cs @@ -9,7 +9,7 @@ namespace NetTally { public class Quests : IQuests, INotifyPropertyChanged { - static List questList = new List(); + static readonly List questList = new List(); IQuest currentQuest; /// diff --git a/NetTally/VoteCounter.cs b/NetTally/VoteCounter.cs index b9b7584d..a955d85f 100644 --- a/NetTally/VoteCounter.cs +++ b/NetTally/VoteCounter.cs @@ -52,23 +52,23 @@ private void SetupFormattingRegexes() string threadAuthor = string.Empty; // A post with ##### at the start of one of the lines is a posting of tally results. Don't read it. - Regex tallyRegex = new Regex(@"^(\[/?[ibu]\]|\[color[^]]+\])*#####", RegexOptions.Multiline); + readonly Regex tallyRegex = new Regex(@"^(\[/?[ibu]\]|\[color[^]]+\])*#####", RegexOptions.Multiline); // A valid vote line must start with [x] or -[x] (with any number of dashes). It must be at the start of the line. - Regex voteRegex = new Regex(@"^(\s|\[/?[ibu]\]|\[color[^]]+\])*-*\[[xX]\].*", RegexOptions.Multiline); + readonly Regex voteRegex = new Regex(@"^(\s|\[/?[ibu]\]|\[color[^]]+\])*-*\[[xX]\].*", RegexOptions.Multiline); // A voter referral is a user name on a vote line, possibly starting with 'Plan'. - Regex voterRegex = new Regex(@"^\s*-*\[[xX]\]\s*([pP][lL][aA][nN]\s*)?(?.*?)[.]?\s*$"); + readonly Regex voterRegex = new Regex(@"^\s*-*\[[xX]\]\s*([pP][lL][aA][nN]\s*)?(?.*?)[.]?\s*$"); // Clean extraneous information from a vote in order to compare with other votes. - Regex cleanRegex = new Regex(@"(\[/?[ibu]\]|\[color[^]]+\]|\[/color\]|\s|\.)"); + readonly Regex cleanRegex = new Regex(@"(\[/?[ibu]\]|\[color[^]]+\]|\[/color\]|\s|\.)"); // Clean extraneous information from a vote line in order to compare with other votes. - Regex cleanLinePartRegex = new Regex(@"(^-+|\[/?[ibu]\]|\[color[^]]+\]|\[/color\]|\s|\.)"); + readonly Regex cleanLinePartRegex = new Regex(@"(^-+|\[/?[ibu]\]|\[color[^]]+\]|\[/color\]|\s|\.)"); // Strip BBCode formatting from a vote line. Use with Replace(). - Regex stripFormattingRegex = new Regex(@"\[/?[ibu]\]|\[/?color[^]]*\]"); + readonly Regex stripFormattingRegex = new Regex(@"\[/?[ibu]\]|\[/?color[^]]*\]"); - List formattingTags = new List() { "color", "b", "i", "u" }; - Dictionary rxStart = new Dictionary(); - Dictionary rxEnd = new Dictionary(); + readonly List formattingTags = new List() { "color", "b", "i", "u" }; + readonly Dictionary rxStart = new Dictionary(); + readonly Dictionary rxEnd = new Dictionary(); - Dictionary cleanVoteLookup = new Dictionary(); + readonly Dictionary cleanVoteLookup = new Dictionary(); /// diff --git a/NetTally/WebPageProvider.cs b/NetTally/WebPageProvider.cs index d013ab55..da0edb82 100644 --- a/NetTally/WebPageProvider.cs +++ b/NetTally/WebPageProvider.cs @@ -19,8 +19,8 @@ public WebPageProvider(IForumData forumData) this.forumData = forumData; } - Dictionary pageCache = new Dictionary(); - Dictionary lastPageLoadedFor = new Dictionary(); + readonly Dictionary pageCache = new Dictionary(); + readonly Dictionary lastPageLoadedFor = new Dictionary(); #region Event handlers public event EventHandler StatusChanged;