public static bool TryGetByFuzzyName(string someName, [MaybeNullWhen(false)] out GameMetaData gameMetaData) { var result = TryGetByFuzzyName(someName); if (result == null) { gameMetaData = Games.Values.First(); return(false); } gameMetaData = result; return(true); }
/// <summary> /// Tries to parse game data from an arbitrary string. Tries first via parsing as a game Enum, then by Nexus name, /// <param nambe="someName"></param> /// <returns></returns> public static GameMetaData GetByFuzzyName(string someName) { if (Enum.TryParse(typeof(Game), someName, true, out var metadata)) { return(((Game)metadata).MetaData()); } GameMetaData result = null; result = GetByNexusName(someName); if (result != null) { return(result); } result = GetByMO2ArchiveName(someName); if (result != null) { return(result); } return(int.TryParse(someName, out int id) ? GetBySteamID(id) : null); }
public GameNotInstalledException(GameMetaData gameMetaData) : base($"Game {gameMetaData.Game} does not appear to be installed.") { }
public static bool TryGetByFuzzyName(string someName, [MaybeNullWhen(false)] out GameMetaData gameMetaData) { gameMetaData = TryGetByFuzzyName(someName); return(gameMetaData != null); }