Exemplo n.º 1
0
 public void Launch()
 {
     if (oneInstance)
     {
         if (FocusApplication.SwitchToRunningInstance(applicationFilePath))
         {
             return;
         }
     }
     process1.StartInfo.FileName         = applicationFilePath;
     process1.StartInfo.Arguments        = arguments;
     process1.StartInfo.WorkingDirectory = workingFolderPath;
     process2.StartInfo.Arguments        = "/s " + ArgumentParser.EscapeArgument(regFilePath);
     process2.Start();
     do
     {
         Thread.Sleep(100);
     } while (!process2.HasExited);
     process1.Start();
 }
Exemplo n.º 2
0
        public void Launch()
        {
            if (oneInstance)
            {
                if (FocusApplication.SwitchToRunningInstance(applicationFilePath))
                {
                    return;
                }
            }
            bool createdNew = false;

            mutex = new Mutex(true, mutexId, out createdNew);
            if (!createdNew)
            {
                return;
            }
            process.StartInfo.FileName         = applicationFilePath;
            process.StartInfo.Arguments        = arguments;
            process.StartInfo.WorkingDirectory = workingFolderPath;
            currentDateTime = GetSystemTime().AddSeconds(interval);
            if (!disableTimeCorrection)
            {
                if (forceTimeCorrection || !IsRealTimeUniversal() && !IsDynamicDaylightTimeDisabled())
                {
                    dateTime = dateTime.Add(TimeZone.CurrentTimeZone.GetUtcOffset(currentDateTime)).Subtract(TimeZone.CurrentTimeZone.GetUtcOffset(dateTime));
                }
            }
            if (currentDateTime.Year != dateTime.Year || currentDateTime.Month != dateTime.Month || currentDateTime.Day != dateTime.Day)
            {
                SetSystemTime(dateTime);
                process.Start();
                Thread.Sleep(interval * 1000);
                SetSystemTime(currentDateTime);
            }
            else
            {
                process.Start();
            }
        }