Skip to content

Commit

Permalink
fixed codefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tolik518 committed Oct 22, 2023
1 parent 6392f8d commit b246465
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 30 deletions.
1 change: 0 additions & 1 deletion SoG_SGreader.Test/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 22 additions & 0 deletions SoG_SGreader/ComandLineOptions.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
1 change: 0 additions & 1 deletion SoG_SGreader/DataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace SoG_SGreader
{
public class DataReader
{

public static Player ReadFromFile(string fileName, ITextBoxWrapper txtConsole)
{
Player playerObject = new Player();
Expand Down
3 changes: 1 addition & 2 deletions SoG_SGreader/Forms/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 0 additions & 2 deletions SoG_SGreader/JsonHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace SoG_SGreader
{
public class JsonHandler
{

private static bool IsDirectory(string jsonFilePath)
{
try
Expand Down Expand Up @@ -46,7 +45,6 @@ public static string SaveGameToJson(Player player, string jsonFilePath)
}

return jsonPath;

}

public static string GetJson(Player player)
Expand Down
27 changes: 5 additions & 22 deletions SoG_SGreader/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Options>(args)
Parser.Default
.ParseArguments<ComandLineOptions>(args)
.WithParsed(RunOptions);
}

static void RunOptions(Options opts)
static void RunOptions(ComandLineOptions opts)
{
if (opts.ShowText)
{
Expand Down Expand Up @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion SoG_SGreader/SoG_SGreader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ComandLineOptions.cs" />
<Compile Include="Enum\SogColors.cs" />
<Compile Include="Enum\SogItems.cs" />
<Compile Include="Enum\SogSkills.cs" />
Expand Down Expand Up @@ -139,7 +140,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Wrapper\ConsoleTextBox.cs" />
<Compile Include="Wrapper\CommandLineTextBox.cs" />
<Compile Include="Wrapper\FakeTextBox.cs" />
<Compile Include="Wrapper\ITextBoxWrapper.cs" />
<Compile Include="Wrapper\UITextBox.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace SoG_SGreader.Wrapper
{
public class ConsoleTextBox : ITextBoxWrapper
public class CommandLineTextBox : ITextBoxWrapper
{
public void AppendText(string text)
{
Expand Down

0 comments on commit b246465

Please sign in to comment.