示例#1
0
        private async void StopStartCAL_Click(object sender, EventArgs e)
        {
            Enabled = false;
            await McrsCalSrvc.ToggleCal();

            Enabled = true;
        }
示例#2
0
        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.");
            }
        }
示例#3
0
        private static void TryUninstallService(string serviceName)
        {
            ServiceController service = McrsCalSrvc.GetService(serviceName);

            if (service != null)
            {
                Logger.Log(serviceName + ": Uninstalling Service...");
                Misc.RunCMD("sc delete \"" + service.ServiceName + "\"").Wait();
                Logger.Good(serviceName + ": Service Uninstalled.");
            }
        }
示例#4
0
 private void Pin_Disposed(object sender, EventArgs e)
 {
     if (McrsCalSrvc.IsRunning())
     {
         StopStartCAL.PerformClick();
     }
     else
     {
         StopStartCAL.Text = "Start CAL";
     }
     Menu = MenuBar;
 }
示例#5
0
        private async void ReDownloadCAL_Click(object sender, EventArgs e)
        {
            Enabled = false;
            if (await Wipe.Do(true))
            {
                await McrsCalSrvc.Start();

                CenterToScreen();
                Left = Left - 440;
            }
            Enabled = true;
        }
示例#6
0
        private async void ReCAL_Click(object sender, EventArgs e)
        {
            Enabled = false;
            await Misc.InstallScheduledTask(Properties.Resources.SuperCALPhaseTwo, "2");

            await DomainJoin.Leave();

            await Misc.SetAutoLogon(false);

            if (await Wipe.Do())
            {
                await McrsCalSrvc.Start();

                CenterToScreen();
                Left = Left - 440;
            }
            Enabled = true;
        }
示例#7
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;
     }));
 }