Skip to content

Commit

Permalink
Fix enumerable save
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 committed Jul 12, 2023
1 parent 2e27112 commit 8eafa53
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Src/GbxToolAPI.CLI/GbxToolAPI.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>1.0.7</Version>
<Version>1.0.8</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

Expand Down
16 changes: 7 additions & 9 deletions Src/GbxToolAPI.CLI/OutputSaver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ public void Save()
{
var outputType = output.GetType();

if (outputType.IsGenericType)
if (output is System.Collections.IEnumerable enumerable)
{
if (output is System.Collections.IEnumerable enumerable)
{
SaveMultiple(enumerable);
}
else
{
SaveGeneric();
}
SaveMultiple(enumerable);
return;
}

if (outputType.IsGenericType)
{
SaveGeneric();
return;
}

Expand Down
8 changes: 7 additions & 1 deletion Src/GbxToolAPI.CLI/ToolConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -753,10 +753,16 @@ private static string GetTypeName(Type type)
}
else
{
if (type.GetGenericTypeDefinition() == typeof(NodeFile<>))
var genericType = type.GetGenericTypeDefinition();

if (genericType == typeof(NodeFile<>))
{
return type.GetGenericArguments()[0].Name;
}
else if (genericType == typeof(IEnumerable<>))
{
return "multiple";
}
}

return "[unknown]";
Expand Down

0 comments on commit 8eafa53

Please sign in to comment.