Skip to content

Commit

Permalink
parser: add cdi and x1 systems (#1712)
Browse files Browse the repository at this point in the history
allow ltm to have any system from SystemCodes
  • Loading branch information
vadosnaprimer authored Oct 15, 2023
1 parent dfc38e7 commit 804827d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 33 deletions.
37 changes: 4 additions & 33 deletions TASVideos.Parsers/Parsers/Ltm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Globalization;
using System.Reflection;
using SharpCompress.Readers;

namespace TASVideos.MovieParsers.Parsers;
Expand Down Expand Up @@ -202,44 +203,14 @@ private static string GetPlatformValue(string str)
return "";
}

return split[0].Trim();
return split[0].Trim().ToLowerInvariant();
}

private static string CalculatePlatform(string str)
{
if (string.Equals(SystemCodes.Arcade, str, StringComparison.InvariantCultureIgnoreCase))
if (typeof(SystemCodes).GetFields().Select(f => f.GetValue(f)).Contains(str))
{
return SystemCodes.Arcade;
}

if (string.Equals(SystemCodes.Dos, str, StringComparison.InvariantCultureIgnoreCase))
{
return SystemCodes.Dos;
}

if (string.Equals(SystemCodes.Flash, str, StringComparison.InvariantCultureIgnoreCase))
{
return SystemCodes.Flash;
}

if (string.Equals(SystemCodes.MacOs, str, StringComparison.InvariantCultureIgnoreCase))
{
return SystemCodes.MacOs;
}

if (string.Equals(SystemCodes.Pc98, str, StringComparison.InvariantCultureIgnoreCase))
{
return SystemCodes.Pc98;
}

if (string.Equals(SystemCodes.Pico8, str, StringComparison.InvariantCultureIgnoreCase))
{
return SystemCodes.Pico8;
}

if (string.Equals(SystemCodes.Windows, str, StringComparison.InvariantCultureIgnoreCase))
{
return SystemCodes.Windows;
return str;
}

return SystemCodes.Linux;
Expand Down
2 changes: 2 additions & 0 deletions TASVideos.Parsers/SystemCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ internal static class SystemCodes
public const string Atari7800 = "a7800";
public const string BSX = "bsx";
public const string C64 = "c64";
public const string Cdi = "cdi";
public const string Coleco = "coleco";
public const string Doom = "doom";
public const string Dos = "dos";
Expand Down Expand Up @@ -54,6 +55,7 @@ internal static class SystemCodes
public const string Wii = "wii";
public const string Windows = "windows";
public const string WSwan = "wswan";
public const string X1 = "x1";
public const string X32 = "32x";
public const string Vectrex = "vec";
public const string ZxSpectrum = "zxs";
Expand Down

0 comments on commit 804827d

Please sign in to comment.