SystemLookup.cs - pointless refactoring

This commit is contained in:
adelikat 2020-03-25 18:36:09 -05:00
parent 7662de47ca
commit 81bcf45d53
1 changed files with 36 additions and 41 deletions

View File

@ -8,55 +8,50 @@ namespace BizHawk.Emulation.Common
{ {
private readonly List<SystemInfo> _systems = new List<SystemInfo> private readonly List<SystemInfo> _systems = new List<SystemInfo>
{ {
new SystemInfo { SystemId = "A26", FullName = "Atari 2600" }, new SystemInfo("A26", "Atari 2600"),
new SystemInfo { SystemId = "A78", FullName = "Atari 7800" }, new SystemInfo("A78", "Atari 7800"),
new SystemInfo { SystemId = "Lynx", FullName = "Atari Lynx" }, new SystemInfo("Lynx", "Atari Lynx"),
new SystemInfo("NES", "NES"),
new SystemInfo { SystemId = "NES", FullName = "NES" }, new SystemInfo("SNES", "Super NES"),
new SystemInfo { SystemId = "SNES", FullName = "Super NES" }, new SystemInfo("N64", "Nintendo 64"),
new SystemInfo { SystemId = "N64", FullName = "Nintendo 64" }, new SystemInfo("GB", "Gameboy"),
new SystemInfo("GBA", "Gameboy Advance"),
new SystemInfo { SystemId = "GB", FullName = "Gameboy" }, new SystemInfo("PSX", "Playstation"),
new SystemInfo { SystemId = "GBA", FullName = "Gameboy Advance" }, new SystemInfo("SMS", "Sega Master System"),
new SystemInfo("GEN", "Sega Genesis/Mega Drive"),
new SystemInfo { SystemId = "PSX", FullName = "Playstation" }, new SystemInfo("32X", "Sega Genesis 32X/Mega Drive 32X"),
new SystemInfo("SAT", "Sega Saturn"),
new SystemInfo { SystemId = "SMS", FullName = "Sega Master System" }, new SystemInfo("PCE", "PC Engine/TurboGrafx 16"),
new SystemInfo { SystemId = "GEN", FullName = "Sega Genesis/Mega Drive" }, new SystemInfo("Coleco", "ColecoVision"),
new SystemInfo { SystemId = "32X", FullName = "Sega Genesis 32X/Mega Drive 32X" }, new SystemInfo("TI83", "TI-83 Calculator"),
new SystemInfo { SystemId = "SAT", FullName = "Sega Saturn" }, new SystemInfo("WSWAN", "WonderSwan"),
new SystemInfo("C64", "Commodore 64"),
new SystemInfo { SystemId = "PCE", FullName = "PC Engine/TurboGrafx 16" }, new SystemInfo("AppleII", "Apple II"),
new SystemInfo { SystemId = "Coleco", FullName = "ColecoVision" }, new SystemInfo("INTV", "IntelliVision"),
new SystemInfo { SystemId = "TI83", FullName = "TI-83 Calculator" }, new SystemInfo("ZXSpectrum", "Sinclair ZX Spectrum"),
new SystemInfo { SystemId = "WSWAN", FullName = "WonderSwan" }, new SystemInfo("AmstradCPC", "Amstrad CPC"),
new SystemInfo("ChannelF", "Fairchild Channel F"),
new SystemInfo { SystemId = "C64", FullName = "Commodore 64" }, new SystemInfo("O2", "Odyssey2"),
new SystemInfo { SystemId = "AppleII", FullName = "Apple II" }, new SystemInfo("VEC", "Vectrex"),
new SystemInfo { SystemId = "INTV", FullName = "IntelliVision" }, new SystemInfo("MSX", "MSX")
new SystemInfo { SystemId = "ZXSpectrum", FullName = "Sinclair ZX Spectrum" },
new SystemInfo { SystemId = "AmstradCPC", FullName = "Amstrad CPC" },
new SystemInfo { SystemId = "ChannelF", FullName = "Fairchild Channel F"},
new SystemInfo { SystemId = "O2", FullName = "Odyssey2"},
new SystemInfo { SystemId = "VEC", FullName = "Vectrex"},
new SystemInfo { SystemId = "MSX", FullName = "MSX"}
}; };
public SystemInfo this[string systemId] public SystemInfo this[string systemId]
{ => _systems.FirstOrDefault(s => s.SystemId == systemId)
get ?? new SystemInfo("Unknown", "Unknown");
{
var system = _systems.FirstOrDefault(s => s.SystemId == systemId);
return system ?? new SystemInfo { SystemId = "Unknown", FullName = "Unknown" };
}
}
public IEnumerable<SystemInfo> AllSystems => _systems; public IEnumerable<SystemInfo> AllSystems => _systems;
public class SystemInfo public class SystemInfo
{ {
public string SystemId { get; set; } public SystemInfo(string systemId, string fullName)
public string FullName { get; set; } {
SystemId = systemId;
FullName = fullName;
}
public string SystemId { get; }
public string FullName { get; }
} }
} }
} }