Beispiel #1
0
        static void Main()
        {
            BootTools.OnBoot();

            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            SystemEvents.SessionEnding += new SessionEndingEventHandler(SessionEnding);

            Gnd.EndProcEvent = new EventWaitHandle(false, EventResetMode.AutoReset, "{8bf2b6c0-0a08-48ae-98f3-b875ce5736d6}");

            foreach (string arg in SystemTools.GetArgq())
            {
                if (StringTools.EqualsIgnoreCase(arg, "/T"))
                {
                    Gnd.EndProcEvent.Set();
                    return;
                }
            }
            Mutex procMutex = new Mutex(false, "{3b5530f0-a0ee-47b9-95fc-8bafab17654c}");

            if (procMutex.WaitOne(0) && GlobalProcMtx.Create("{44e1b3d2-e451-429e-b0c3-40c377244f10}", APP_TITLE))
            {
                CheckSelfDir();
                CheckCopiedExe();

                SystemTools.AntiWindowsDefenderSmartScreen();

                Gnd.LoadConfFile();

                // HTT.exe ゾンビ対策は HTTProc.ctor でやってる。

                // orig >

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

                // < orig

                GlobalProcMtx.Release();
                procMutex.ReleaseMutex();
            }
            procMutex.Close();
        }
Beispiel #2
0
        public HTTProc()
        {
            try
            {
                EndRq();                 // 念のため!

                ProcessStartInfo psi = new ProcessStartInfo();

                psi.FileName  = GetHttFile();
                psi.Arguments = "/U " + Gnd.HTT_APP_UUID + " /P " + Gnd.Sd.PortNo + " /S " + GetServiceFile();

                PostInitPSI(psi);

                this.Proc = Process.Start(psi);
            }
            catch (Exception e)
            {
                SystemTools.Error(e);
            }
        }
Beispiel #3
0
        public void Destroy_BusyDlg()
        {
            try
            {
                EndRq();

                using (BusyWin f = new BusyWin(delegate()
                {
                    return(this.Proc != null && this.Proc.HasExited == false);
                }
                                               ))
                {
                    f.ShowDialog();
                }

                this.Proc = null;
            }
            catch (Exception e)
            {
                SystemTools.Error(e);
            }
        }
Beispiel #4
0
        // ----

        public static void LoadConfFile()
        {
            try
            {
                string[] lines = File.ReadAllLines(Path.Combine(BootTools.SelfDir, "HTTDir.conf"));
                lines = いらん行を除去(lines);
                int c = 0;

                if (int.Parse(lines[c++]) != lines.Length)
                {
                    throw new Exception("Bad Item-Count");
                }

                // ---- Items ----

                AccessIconEnabled = int.Parse(lines[c++]) != 0;

                // ----
            }
            catch (Exception e)
            {
                SystemTools.WriteLog(e);
            }
        }