コード例 #1
0
ファイル: Main.cs プロジェクト: Cedar-Point/SuperCAL
        private void Window_Load(object sender, EventArgs e)
        {
            bool allowContinue = true;

            if (Program.Arguments.Length != 0)
            {
                string firstArg = Program.Arguments[0].ToLower();
                if (firstArg == "0")
                {
                    PhaseTwo();
                    allowContinue = false;
                }
                if (firstArg == "3")
                {
                    PhaseThree();
                    allowContinue = false;
                }
                if (firstArg == "/recal" || firstArg == "-recal")
                {
                    Logger.Log("ReCAL: ReCAL Switch Passed in CLI, Starting ReCAL process...");
                    ReCAL.PerformClick();
                    allowContinue = false;
                }
                if (firstArg == "/redownload" || firstArg == "-redownload")
                {
                    Logger.Log("ReDownload: ReDownload Switch Passed in CLI, Starting ReDownload process...");
                    ReDownloadCAL.PerformClick();
                    allowContinue = false;
                }
            }
            if (allowContinue)
            {
                if (Pin.UnlockPin != "")
                {
                    Control pin = new Pin();
                    pin.Disposed += Pin_Disposed;
                    Controls.Add(pin);
                    pin.Width  = ClientSize.Width;
                    pin.Height = ClientSize.Height;
                    pin.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left;
                    pin.BringToFront();
                    pin.Select();
                    pin.Show();
                }
                else
                {
                    if (McrsCalSrvc.IsRunning())
                    {
                        StopStartCAL.PerformClick();
                    }
                    else
                    {
                        StopStartCAL.Text = "Start CAL";
                    }
                    Menu = MenuBar;
                }
                Logger.Log("Welcome to Super CAL: Press any button to begin.");
            }
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: Cedar-Point/SuperCAL
 private void Pin_Disposed(object sender, EventArgs e)
 {
     if (McrsCalSrvc.IsRunning())
     {
         StopStartCAL.PerformClick();
     }
     else
     {
         StopStartCAL.Text = "Start CAL";
     }
     Menu = MenuBar;
 }
コード例 #3
0
 public async static Task <bool> Do(bool softWipe = false)
 {
     if (McrsCalSrvc.IsRunning())
     {
         await McrsCalSrvc.Stop();
     }
     return(await Task.Run(() => {
         RegDictionary = new Dictionary <string, object>
         {
             ["ActiveHostIpAddress"] = EGatewayURL,
             ["ActiveHost"] = EGatewayHost,
             ["POSType"] = 101
         };
         if (softWipe)
         {
             SaveImportantKeys(false);
             SaveImportantKeys(true);
         }
         Logger.Log("Deleting the specified files and folders...");
         foreach (string file in Config2.Settings["FilesToDelete"].Split('|'))
         {
             if (file == "")
             {
                 break;
             }
             if (!DeleteFile(file))
             {
                 return false;
             }
         }
         foreach (string folder in Config2.Settings["FoldersToDelete"].Split('|'))
         {
             if (folder == "")
             {
                 break;
             }
             if (!DeleteDirectory(folder))
             {
                 return false;
             }
         }
         Logger.Good("Files and folders deleted.");
         TryUninstallService("MICROS KDS Controller");
         RegClear(false);
         RegClear(true);
         if (softWipe)
         {
             Logger.Log("Adding HwConfigured value to the CAL registry key...");
             try
             {
                 RegistryKey regKey32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(MicrosRegRoot + @"\CAL", true);
                 regKey32.SetValue("HwConfigured", 1);
                 regKey32.Close();
             }
             catch (Exception)
             {
                 Logger.Warning("Failed to set HwConfigured key in the 32 bit hive.");
             }
             try
             {
                 RegistryKey regKey64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(MicrosRegRoot + @"\CAL", true);
                 regKey64.SetValue("HwConfigured", 1);
                 regKey64.Close();
             }
             catch (Exception)
             {
                 Logger.Warning("Failed to set HwConfigured key in the 64 bit hive.");
             }
         }
         Logger.Good("Done.");
         return true;
     }));
 }