private static GameLocationInfo GetGameLocation(String[] args) { try { GameLocationInfo result; if (args == null || args.Length == 0) { if (File.Exists(GameLocationInfo.LauncherName)) { result = new GameLocationInfo(Environment.CurrentDirectory); result.Validate(); } else { result = GameLocationSteamRegistryProvider.TryLoad(); } } else { result = new GameLocationInfo(args[0]); result.Validate(); } return(result); } catch (Exception ex) { Console.WriteLine("Failed to get a game location."); Console.WriteLine("---------------------------"); Console.WriteLine(ex); Console.WriteLine("---------------------------"); return(null); } }
private static GameLocationInfo GetGameLocation(String[] args) { try { GameLocationInfo result; if (args.IsNullOrEmpty()) { if (File.Exists(GameLocationInfo.LauncherName)) { result = new GameLocationInfo(Environment.CurrentDirectory); result.Validate(); } else { result = GameLocationSteamRegistryProvider.TryLoad(); } } else { result = new GameLocationInfo(args[0]); result.Validate(); } return(result); } catch (Exception ex) { Log.Error(ex, "Failed to get a game location."); Console.WriteLine($"Failed to get a game location. See [{Log.LogFileName}] for details."); return(null); } }
private static GameLocationInfo TryLoadLocation(RegistryKey localMachine) { using (RegistryKey registryKey = localMachine.OpenSubKey(SteamRegistyPath)) { if (registryKey == null) { return(null); } GameLocationInfo result = new GameLocationInfo((string)registryKey.GetValue(SteamGamePathTag)); result.Validate(); return(result); } }