0.2.0-dev Download ZIP
32 lines ·1.1 KB Raw
| 1 | using EvilEngine.Adapters.Steam; |
| 2 | using EvilEngine.Conversion; |
| 3 | using EvilEngine.Mounts; |
| 4 | |
| 5 | namespace EvilEngine.Adapters.GoldSrc; |
| 6 | |
| 7 | public sealed class GoldSrc : IAdapter |
| 8 | { |
| 9 | public static readonly GoldSrcRow HalfLife = new("half-life", "70", GoldSrcGame.BaseFolder, "Half-Life"); |
| 10 | |
| 11 | public static IReadOnlyList<GoldSrcRow> Rows { get; } = [HalfLife]; |
| 12 | |
| 13 | public void Register(AdapterContext context) |
| 14 | { |
| 15 | foreach (var row in Rows) |
| 16 | { |
| 17 | context.AddGame(new GoldSrcGame(row)); |
| 18 | context.AddConverter(row.Key, new MusicFileConverter()); |
| 19 | context.AddConverter(row.Key, new SoundtrackRecords([new SoundtrackFolder(GoldSrcGame.MediaFolder)], |
| 20 | layer => OwnLayer(row, layer) |
| 21 | ? new SoundtrackGame(row.Title, $"{SteamFinder.StoreName}:app/{row.AppId}") |
| 22 | : null)); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | private static bool OwnLayer(GoldSrcRow row, string layer) |
| 27 | { |
| 28 | var folder = layer.Split(VirtualPath.Separator)[0]; |
| 29 | return folder.Equals(row.Folder, StringComparison.OrdinalIgnoreCase) || |
| 30 | folder.Equals($"{row.Folder}_hd", StringComparison.OrdinalIgnoreCase); |
| 31 | } |
| 32 | } |