diff --git a/SoG_SGreader.Test/IntegrationTests.cs b/SoG_SGreader.Test/IntegrationTests.cs index 1bdfddd..3d015e4 100644 --- a/SoG_SGreader.Test/IntegrationTests.cs +++ b/SoG_SGreader.Test/IntegrationTests.cs @@ -18,7 +18,6 @@ private static string GetExePath() } return Path.Combine(projectDirectory, "SoG_SGreader", "bin", "Debug", "SoG_SGreader.exe"); - } private static string GetSaveGamePath(string saveGameNumber) diff --git a/SoG_SGreader/ComandLineOptions.cs b/SoG_SGreader/ComandLineOptions.cs new file mode 100644 index 0000000..bd35764 --- /dev/null +++ b/SoG_SGreader/ComandLineOptions.cs @@ -0,0 +1,22 @@ +using CommandLine; + +namespace SoG_SGreader +{ + class ComandLineOptions + { + [Value(0, MetaName = "savegame path", Required = false, HelpText = "Path to the savegame")] + public string SavegamePath { get; set; } + + [Option('t', "text", HelpText = "Show a short summary of the savegame")] + public bool ShowText { get; set; } + + [Option('j', "json", HelpText = "Print json of the savegame to console")] + public bool ShowJson { get; set; } + + [Option('h', "help", HelpText = "Show help")] + public bool ShowHelp { get; set; } + + [Option('p', "patch", HelpText = "Show the current supported patch version")] + public bool ShowPatch { get; set; } + } +} \ No newline at end of file diff --git a/SoG_SGreader/DataReader.cs b/SoG_SGreader/DataReader.cs index 3495042..bdf13d0 100644 --- a/SoG_SGreader/DataReader.cs +++ b/SoG_SGreader/DataReader.cs @@ -7,7 +7,6 @@ namespace SoG_SGreader { public class DataReader { - public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole) { Player playerObject = new Player(); diff --git a/SoG_SGreader/Forms/FrmMain.cs b/SoG_SGreader/Forms/FrmMain.cs index f84214e..8379c1f 100644 --- a/SoG_SGreader/Forms/FrmMain.cs +++ b/SoG_SGreader/Forms/FrmMain.cs @@ -129,8 +129,7 @@ private string[] FilterItems(string[] items, params string[] prefixes) { return items.Where(item => prefixes.Any(item.StartsWith) || item == "Null").ToArray(); } - - + private void InitFields() { var items = Enum.GetNames(typeof(SogItems)); diff --git a/SoG_SGreader/JsonHandler.cs b/SoG_SGreader/JsonHandler.cs index 9199bf2..8984984 100644 --- a/SoG_SGreader/JsonHandler.cs +++ b/SoG_SGreader/JsonHandler.cs @@ -6,7 +6,6 @@ namespace SoG_SGreader { public class JsonHandler { - private static bool IsDirectory(string jsonFilePath) { try @@ -46,7 +45,6 @@ public static string SaveGameToJson(Player player, string jsonFilePath) } return jsonPath; - } public static string GetJson(Player player) diff --git a/SoG_SGreader/Program.cs b/SoG_SGreader/Program.cs index b66ed94..a2ab374 100644 --- a/SoG_SGreader/Program.cs +++ b/SoG_SGreader/Program.cs @@ -5,34 +5,17 @@ namespace SoG_SGreader { - class Options - { - [Value(0, MetaName = "savegame path", Required = false, HelpText = "Path to the savegame")] - public string SavegamePath { get; set; } - - [Option('t', "text", HelpText = "Show a short summary of the savegame")] - public bool ShowText { get; set; } - - [Option('j', "json", HelpText = "Print json of the savegame to console")] - public bool ShowJson { get; set; } - - [Option('h', "help", HelpText = "Show help")] - public bool ShowHelp { get; set; } - - [Option('p', "patch", HelpText = "Show the current supported patch version")] - public bool ShowPatch { get; set; } - } - public static class Program { [STAThread] static void Main(string[] args) { - Parser.Default.ParseArguments(args) + Parser.Default + .ParseArguments(args) .WithParsed(RunOptions); } - static void RunOptions(Options opts) + static void RunOptions(ComandLineOptions opts) { if (opts.ShowText) { @@ -60,10 +43,10 @@ public static void DisplayTextSummary(string savegamePath) return; } - ConsoleTextBox consoleTextBox = new ConsoleTextBox(); + CommandLineTextBox commandLineTextBox = new CommandLineTextBox(); try { - DataReader.ReadFromFile(savegamePath, consoleTextBox); + DataReader.ReadFromFile(savegamePath, commandLineTextBox); } catch (Exception e) { diff --git a/SoG_SGreader/SoG_SGreader.csproj b/SoG_SGreader/SoG_SGreader.csproj index e9c3ff2..b571195 100644 --- a/SoG_SGreader/SoG_SGreader.csproj +++ b/SoG_SGreader/SoG_SGreader.csproj @@ -107,6 +107,7 @@ + @@ -139,7 +140,7 @@ True Resources.resx - + diff --git a/SoG_SGreader/Wrapper/ConsoleTextBox.cs b/SoG_SGreader/Wrapper/CommandLineTextBox.cs similarity index 74% rename from SoG_SGreader/Wrapper/ConsoleTextBox.cs rename to SoG_SGreader/Wrapper/CommandLineTextBox.cs index b23b787..a041c8c 100644 --- a/SoG_SGreader/Wrapper/ConsoleTextBox.cs +++ b/SoG_SGreader/Wrapper/CommandLineTextBox.cs @@ -2,7 +2,7 @@ namespace SoG_SGreader.Wrapper { - public class ConsoleTextBox : ITextBoxWrapper + public class CommandLineTextBox : ITextBoxWrapper { public void AppendText(string text) {