From 8952a14d09669fd78726d1e1939a83cc97e457d7 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sat, 10 Jun 2023 00:16:17 -0700 Subject: [PATCH] dont wait for achievement lol --- SteamRerouter/ModSide/Interop.cs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/SteamRerouter/ModSide/Interop.cs b/SteamRerouter/ModSide/Interop.cs index 9a7d319c..1e98c7d6 100644 --- a/SteamRerouter/ModSide/Interop.cs +++ b/SteamRerouter/ModSide/Interop.cs @@ -28,18 +28,18 @@ public static class Interop private static bool IsDlcOwned() { - var ownershipStatus = DoCommand(0) != 0; + var ownershipStatus = DoCommand(true, 0) != 0; Log($"dlc owned: {ownershipStatus}"); return ownershipStatus; } public static void EarnAchivement(Achievements.Type type) { - DoCommand(1, (int)type); - Log($"earned achievement {type}"); + Log($"earn achievement {type}"); + DoCommand(false, 1, (int)type); } - private static int DoCommand(int type, int arg = default) + private static int DoCommand(bool wait, int type, int arg = default) { var processPath = Path.Combine( Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, @@ -68,12 +68,16 @@ public static class Interop RedirectStandardOutput = true, RedirectStandardError = true }); - process!.WaitForExit(); + if (wait) + { + process!.WaitForExit(); - Log($"StandardOutput:\n{process.StandardOutput.ReadToEnd()}"); - LogError($"StandardError:\n{process.StandardError.ReadToEnd()}"); - Log($"ExitCode: {process.ExitCode}"); + Log($"StandardOutput:\n{process.StandardOutput.ReadToEnd()}"); + LogError($"StandardError:\n{process.StandardError.ReadToEnd()}"); + Log($"ExitCode: {process.ExitCode}"); - return process.ExitCode; + return process.ExitCode; + } + return -1; } }