コード例 #1
0
ファイル: DLG_Calibrar.cs プロジェクト: luckypal/Kiosk
        private void bClock_Click(object sender, EventArgs e)
        {
            MSGBOX_Timer mSGBOX_Timer = new MSGBOX_Timer("Updating Date/Time from Internet server. Wait 30 seconds", "", 30, _full: true);

            mSGBOX_Timer.Show();
            Program.Update_DateTime();
            Thread.Sleep(30000);
            mSGBOX_Timer.Close();
            MSGBOX_Timer mSGBOX_Timer2 = new MSGBOX_Timer("Current Date/Time " + DateTime.Now.ToLongDateString(), "", 5, _full: true);

            mSGBOX_Timer2.ShowDialog();
        }
コード例 #2
0
        private static void Main()
        {
            bool flag = true;

            flag = false;
            Check_DNS();
            string text  = "c:\\kiosk\\Loader.exe";
            string text2 = "c:\\kiosk\\_Loader.exe";
            string path  = "c:\\kiosk\\_Loader.exe.ver";
            string path2 = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\kiosk.options.tmp";

            if (File.Exists(path2))
            {
                try
                {
                    File.Delete(path2);
                }
                catch
                {
                }
            }
            flag = true;
            if (File.Exists(text) && File.Exists(text2) && File.Exists(path) && !FileEquals(text, text2) && Util.HashFile(text2, _create: false) && FindAndKillProcess("Loader"))
            {
                Thread.Sleep(2000);
                if (!FindAndKillProcess("Loader"))
                {
                    try
                    {
                        File.Delete(text);
                    }
                    catch
                    {
                    }
                    Thread.Sleep(1000);
                    try
                    {
                        File.Copy(text2, text);
                    }
                    catch
                    {
                    }
                    Thread.Sleep(1000);
                    Reboot();
                    Thread.Sleep(10000);
                    Application.Exit();
                }
            }
            flag = true;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(defaultValue: false);
            Configuracion _opc = new Configuracion();

            _opc.Set_AppName("kiosk".ToLower());
            flag = true;
            if (File.Exists(_opc.CfgFileFull + ".tmp"))
            {
                try
                {
                    File.Delete(_opc.CfgFileFull + ".tmp");
                }
                catch
                {
                }
            }
            flag = true;
            _opc.Load_Net();
            flag = true;
            if (_opc.Reset == 1)
            {
                flag = true;
                _opc.Save_Net();
            }
            flag = true;
            if (_opc.MACLAN != "0")
            {
                _opc.Save_Net($"{_opc.MACLAN}", "cfg");
            }
            flag = true;
            flag = false;
            Update_DateTime();
            flag = true;
            if (_opc.unique)
            {
                Process[] processesByName = Process.GetProcessesByName(Assembly.GetExecutingAssembly().GetName().Name);
                if (processesByName.Length > 1)
                {
                    return;
                }
            }
            Configuracion.CleanUpDisk();
            string text3 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\uvnc bvba\\UltraVNC\\winvnc.exe";

            if (File.Exists(text3) && Configuracion.VNC_Check_Timestamp() == 1)
            {
                Process.Start(text3, "-connect " + _opc.Server_VNC + ":5500 -run");
            }
            flag = true;
            string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            string path3      = folderPath + "\\Toolwiz Time Freeze 2014\\ToolwizTimeFreeze.exe";

            if (File.Exists(path3) && Configuracion.Freeze_Check() == 0 && Configuracion.Freeze_Check_Timestamp() == 0)
            {
                Configuracion.Freeze_On();
            }
            flag = true;
            if (_opc.VersionPRG == "update")
            {
                Process.Start("shutdown.exe", "/r");
                return;
            }
            for (int i = 0; i < 5; i++)
            {
                if (PingTest())
                {
                    break;
                }
                for (int j = 0; j < 100; j++)
                {
                    Application.DoEvents();
                    Thread.Sleep(10);
                }
            }
            flag = true;
            if (!PingTest())
            {
                MSGBOX_Timer mSGBOX_Timer = new MSGBOX_Timer("No INTERNET Connection. Check Network cable, network parameters or WIFI", "Ok", 5);
                mSGBOX_Timer.ShowDialog();
            }
            Configuracion.Access_Log("Load Kiosk");
            flag = true;
            if (FindWinPCapProcess() || FindVMWareProcess() || FindWiresharkProcess() || RedPill() == 1)
            {
                _opc.ForceSpy = true;
            }
            flag = true;
            Application.Run(new MainWindow(ref _opc));
            flag = false;
            if (FindAndKillProcess("Loader"))
            {
                Thread.Sleep(2000);
                if (!FindAndKillProcess("Loader"))
                {
                    RunProcess(text);
                    Application.Exit();
                }
            }
        }