diff --git a/WhiteRabbit/App.config b/WhiteRabbit/App.config index 8324aa6..6566d25 100644 --- a/WhiteRabbit/App.config +++ b/WhiteRabbit/App.config @@ -1,6 +1,11 @@  - - - - \ No newline at end of file + + + + + + + + + diff --git a/WhiteRabbit/Program.cs b/WhiteRabbit/Program.cs index 978d8ed..843d076 100644 --- a/WhiteRabbit/Program.cs +++ b/WhiteRabbit/Program.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; + using System.Configuration; using System.Diagnostics; using System.Linq; using System.Numerics; @@ -14,10 +15,6 @@ /// public static class Program { - private const string SourcePhrase = "poultry outwits ants"; - - private const int MaxWordsInPhrase = 5; - /// /// Main entry point /// @@ -26,19 +23,24 @@ var stopwatch = new Stopwatch(); stopwatch.Start(); - var expectedHashes = new[] - { - "e4820b45d2277f3844eac66c903e84be", - "23170acc097c24edb98fc5488ab033fe", - "665e5bcb0c20062fe8abaaf4628bb154", - }; + var sourcePhrase = ConfigurationManager.AppSettings["SourcePhrase"]; + var sourceChars = ToOrderedChars(sourcePhrase); - var expectedHashesAsVectors = expectedHashes.Select(hash => new Vector(HexadecimalStringToByteArray(hash))).ToArray(); + var maxWordsInPhrase = int.Parse(ConfigurationManager.AppSettings["MaxWordsInPhrase"]); + var expectedHashesAsVectors = ConfigurationManager.AppSettings["ExpectedHashes"] + .Split(',') + .Select(hash => new Vector(HexadecimalStringToByteArray(hash))) + .ToArray(); + +#if DEBUG var anagramsBag = new ConcurrentBag(); - var sourceChars = ToOrderedChars(SourcePhrase); +#endif - var processor = new StringsProcessor(Encoding.ASCII.GetBytes(SourcePhrase), MaxWordsInPhrase, ReadInput()); + var processor = new StringsProcessor( + Encoding.ASCII.GetBytes(sourcePhrase), + maxWordsInPhrase, + ReadInput()); Console.WriteLine($"Initialization complete; time from start: {stopwatch.Elapsed}"); diff --git a/WhiteRabbit/WhiteRabbit.csproj b/WhiteRabbit/WhiteRabbit.csproj index 144e295..3c42aeb 100644 --- a/WhiteRabbit/WhiteRabbit.csproj +++ b/WhiteRabbit/WhiteRabbit.csproj @@ -45,6 +45,7 @@ ..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll True +