Exemplo n.º 1
0
 public static void CheckForUpdate(Action <HldsUpdateEventArgs> completedCallback)
 {
     _updateThread = ThreadUtil.GetThread(() =>
     {
         string[] response = GetResponseString().Replace("\r", "").Split('\n');
         if (response[0] == OK)
         {
             if (response[1] == NEW_VERSION_AVAILABLE)
             {
                 completedCallback(new HldsUpdateEventArgs()
                 {
                     UpdateStatus = Enums.HldsUpdateStatus.NewVersionAvailable,
                     NewVersion   = response[2],
                     UpdateUrl    = response[3]
                 });
             }
             else if (response[1] == NO_NEW_VERSION_AVAILABLE)
             {
                 completedCallback(new HldsUpdateEventArgs()
                 {
                     UpdateStatus = Enums.HldsUpdateStatus.NoNewVersionAvailable
                 });
             }
         }
         else
         {
             completedCallback(new HldsUpdateEventArgs()
             {
                 UpdateStatus = Enums.HldsUpdateStatus.Fail
             });
         }
     });
     _updateThread.Start();
 }
Exemplo n.º 2
0
 static NtTimerResolutionUtil()
 {
     WinAPI.NtQueryTimerResolution(out _max, out _min, out _actual);
     timerSetterThread = ThreadUtil.GetThread(() =>
     {
         while (true)
         {
             int newResolution = _actual;
             WinAPI.NtSetTimerResolution(newResolution, true, out _actual);
             Thread.Sleep(1000);
         }
     });
     timerSetterThread.IsBackground = true;
     timerSetterThread.Start();
 }