private async void Updater() { while (true) { try { var updatedNeeded = await CheckForClientUpdates(); if (updatedNeeded) { Console.WriteLine("Client was updated"); } if (SessionInfo.GetSessionLockState((uint)System.Diagnostics.Process.GetCurrentProcess().SessionId) == SessionInfo.LockState.Unlocked) { Console.WriteLine("Checking for Updates"); CheckForServerUpdates(); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Console.WriteLine(ex.Message); } await Task.Delay(new TimeSpan(0, 30, 0)); } }