Start stopwatch after Steam API init

This commit is contained in:
Jaex 2021-10-26 14:15:49 +03:00
parent c75b689ee5
commit 5da2077e10

View file

@ -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
{