Skip to content

Commit 0b8c40e

Browse files
committed
Update Program.cs
1 parent bec1b45 commit 0b8c40e

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

UnturnedRedistUpdateTool/Program.cs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,22 +59,14 @@ public static async Task<int> Main(string[] args)
5959

6060
Console.WriteLine("Preparing to run tool...");
6161

62-
Console.WriteLine("Directories: " + string.Join(", ", Directory.GetDirectories(path)));
63-
64-
var executableDirectory = Path.Combine(path, "steamcmd");
65-
if (Directory.Exists(executableDirectory) == false)
66-
{
67-
Console.WriteLine($"executable Directory not found: \"{executableDirectory}\"");
68-
return 1;
69-
}
70-
Console.WriteLine("steamcmd Directories: " + string.Join(", ", Directory.GetDirectories(executableDirectory)));
71-
72-
var steamappsDirectory = Path.Combine(executableDirectory, "steamapps");
62+
var steamappsDirectory = Path.Combine(path, "steamapps");
7363
if (Directory.Exists(steamappsDirectory) == false)
7464
{
7565
Console.WriteLine($"steamapps Directory not found: \"{steamappsDirectory}\"");
7666
return 1;
7767
}
68+
Console.WriteLine("steamappsDirectory: " + string.Join(", ", Directory.GetDirectories(steamappsDirectory)));
69+
7870
var commonDirectory = Path.Combine(steamappsDirectory, "common");
7971
if (Directory.Exists(commonDirectory) == false)
8072
{
@@ -108,7 +100,7 @@ public static async Task<int> Main(string[] args)
108100
{
109101
throw new FileNotFoundException("Required file is not found", statusFilePath);
110102
}
111-
var (version, buildId) = await GetInfo(unturnedDirectory, executableDirectory, AppId);
103+
var (version, buildId) = await GetInfo(unturnedDirectory, steamappsDirectory, AppId);
112104

113105
Console.WriteLine($"Found Unturned v{version} ({buildId})");
114106

@@ -197,13 +189,13 @@ void UpdateRedist(string unturnedManagedDirectory)
197189
return null;
198190
}
199191

200-
private static async Task<(string version, string buildId)> GetInfo(string unturnedDirectory, string executablePath, string appId)
192+
private static async Task<(string version, string buildId)> GetInfo(string unturnedPath, string steamappsPath, string appId)
201193
{
202-
var node = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(unturnedDirectory, "Status.json")))!["Game"]!;
194+
var node = JsonNode.Parse(await File.ReadAllTextAsync(Path.Combine(unturnedPath, "Status.json")))!["Game"]!;
203195
var version = $"3.{node["Major_Version"]}.{node["Minor_Version"]}.{node["Patch_Version"]}";
204196

205197
var appmanifestFileName = $"appmanifest_{appId}.acf";
206-
var appdataPath = Path.Combine(executablePath, "steamapps", appmanifestFileName);
198+
var appdataPath = Path.Combine(steamappsPath, "steamapps", appmanifestFileName);
207199
if (!File.Exists(appdataPath))
208200
{
209201
throw new FileNotFoundException("Required file is not found", appmanifestFileName);

0 commit comments

Comments
 (0)