From 5da2077e10130e7ec58a6d5d8d91f3228d75b70b Mon Sep 17 00:00:00 2001 From: Jaex Date: Tue, 26 Oct 2021 14:15:49 +0300 Subject: [PATCH] Start stopwatch after Steam API init --- ShareX.Steam/Launcher.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ShareX.Steam/Launcher.cs b/ShareX.Steam/Launcher.cs index a68578eaf..63439880a 100644 --- a/ShareX.Steam/Launcher.cs +++ b/ShareX.Steam/Launcher.cs @@ -43,11 +43,10 @@ public static class Launcher private static string UpdateExecutablePath = Path.Combine(UpdateFolderPath, "ShareX.exe"); private static bool IsFirstTimeRunning, IsStartupRun, ShowInApp, IsSteamInit; + private static Stopwatch SteamInitStopwatch; public static void Run(string[] args) { - Stopwatch startTimer = Stopwatch.StartNew(); - if (Helpers.IsCommandExist(args, "-uninstall")) { UninstallShareX(); @@ -82,6 +81,7 @@ public static void Run(string[] args) if (IsSteamInit) { + SteamInitStopwatch = Stopwatch.StartNew(); break; } @@ -91,7 +91,7 @@ public static void Run(string[] args) if (IsUpdateRequired()) { - DoUpdate(); + UpdateShareX(); } if (IsSteamInit) @@ -121,7 +121,12 @@ public static void Run(string[] args) { // Reason for this workaround is because Steam only allows writing review if user is played the game at least 5 minutes. // For this reason ShareX launcher will stay on for at least 10 seconds to let users eventually reach 5 minutes play time. - int waitTime = 10000 - (int)startTimer.ElapsedMilliseconds; + int waitTime = 10000; + + if (SteamInitStopwatch != null) + { + waitTime -= (int)SteamInitStopwatch.ElapsedMilliseconds; + } if (waitTime > 0) { @@ -188,7 +193,7 @@ private static bool IsUpdateRequired() return false; } - private static void DoUpdate() + private static void UpdateShareX() { try {