()
| 55 | } |
| 56 | |
| 57 | static int RunStFixer() |
| 58 | { |
| 59 | Console.WriteLine("=== CloudRedirect STFixer ==="); |
| 60 | Console.WriteLine(); |
| 61 | |
| 62 | // Find Steam |
| 63 | var steamPath = SteamDetector.FindSteamPath(); |
| 64 | if (steamPath == null) |
| 65 | { |
| 66 | Console.Error.WriteLine("ERROR: Steam installation not found."); |
| 67 | Console.Error.WriteLine("Checked registry and common install paths."); |
| 68 | return 1; |
| 69 | } |
| 70 | Console.WriteLine($"Steam: {steamPath}"); |
| 71 | |
| 72 | // Check version (warn but continue) |
| 73 | var version = SteamDetector.GetSteamVersion(steamPath); |
| 74 | if (version == null) |
| 75 | { |
| 76 | Console.WriteLine("WARNING: Could not read Steam version -- continuing anyway."); |
| 77 | } |
| 78 | else if (!SteamDetector.IsSupportedSteamVersion(version.Value)) |
| 79 | { |
| 80 | Console.WriteLine($"WARNING: Steam version {version.Value} not in whitelist -- continuing anyway."); |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | Console.WriteLine($"Steam version: {version.Value} (OK)"); |
| 85 | } |
| 86 | |
| 87 | // Close Steam if running |
| 88 | if (SteamDetector.IsSteamRunning()) |
| 89 | { |
| 90 | Console.WriteLine("Steam is running -- shutting it down..."); |
| 91 | var steamExe = Path.Combine(steamPath, "steam.exe"); |
| 92 | if (File.Exists(steamExe)) |
| 93 | { |
| 94 | try |
| 95 | { |
| 96 | System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo |
| 97 | { |
| 98 | FileName = steamExe, |
| 99 | Arguments = "-shutdown", |
| 100 | UseShellExecute = true |
| 101 | })?.Dispose(); |
| 102 | } |
| 103 | catch { } |
| 104 | } |
| 105 | |
| 106 | for (int i = 0; i < 30; i++) |
| 107 | { |
| 108 | System.Threading.Thread.Sleep(500); |
| 109 | if (!SteamDetector.IsSteamRunning()) break; |
| 110 | } |
| 111 | |
| 112 | if (SteamDetector.IsSteamRunning()) |
| 113 | { |
| 114 | Console.WriteLine("Graceful shutdown timed out, killing Steam..."); |
nothing calls this directly
no test coverage detected