Esempio n. 1
0
        static void Main()
        {
            onBoot();

            Application.ThreadException += new ThreadExceptionEventHandler(applicationThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomainUnhandledException);
            SystemEvents.SessionEnding += new SessionEndingEventHandler(sessionEnding);

            Mutex procMutex = new Mutex(false, APP_IDENT);

            if (procMutex.WaitOne(0) && GlobalProcMtx.Create(Consts.PROJECT_GUI_IDENT, APP_TITLE))
            {
                checkSelfDir();
                Directory.SetCurrentDirectory(selfDir);
                checkAloneExe();
                checkLogonUser();

                Ground.i = new Ground();

                Utils.AntiWindowsDefenderSmartScreen();

                //Gnd.i.logger.clear();
                Ground.i.loadConf();
                Ground.i.loadData();

                // Kill Zombies
                {
                    using (NamedEventObject ev = new NamedEventObject(Consts.EV_STOP_SENDER))
                    {
                        ev.set();
                    }
                    using (NamedEventObject ev = new NamedEventObject(Consts.EV_STOP_RECORDER))
                    {
                        ev.set();
                    }
                    // crypTunnel -> CrypTunnelProc.cs
                }

                // orig >

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainWin());

                // < orig

                Ground.i.saveData();

                // release Gnd.i
                {
                    // noop
                }

                FileTools.clearTMP();

                GlobalProcMtx.Release();
                procMutex.ReleaseMutex();
            }
            procMutex.Close();
        }
Esempio n. 2
0
 public void Dispose()
 {
     if (_proc != null)
     {
         using (NamedEventObject evStop = new NamedEventObject(Consts.EV_STOP_RECORDER))
         {
             do
             {
                 evStop.set();
             }while (_proc.WaitForExit(2000) == false);
         }
         _proc = null;
     }
 }
Esempio n. 3
0
        private static void main3()
        {
            wRootDir = getWRootDir();

            using (NamedEventObject evStop = new NamedEventObject(Consts.EV_STOP))
            {
                long nextTimeSec = -1L;

                while (evStop.waitForMillis(2000) == false)
                {
                    if (Console.KeyAvailable)
                    {
                        if (Console.ReadKey(true).KeyChar == 0x1b)
                        {
                            Console.WriteLine("ESCAPE Pressed");
                            throw new Ended();
                        }
                        else
                        {
                            Console.WriteLine("Press ESCAPE to exit.");
                        }
                    }
                    long timeSec = DateTimeToSec.Now.getSec();

                    if (nextTimeSec <= timeSec)
                    {
#if !true
                        procRatePage();
                        nextTimeSec = (timeSec / 20L + 1L) * 20L;
#else
                        if (procRatePage())
                        {
                            nextTimeSec = (timeSec / 60L + 1L) * 60L;
                        }
                        else
                        {
                            nextTimeSec = (timeSec / 20L + 1L) * 20L;
                        }
#endif
                        GC.Collect();
                    }
                }
            }
        }