Ejemplo n.º 1
0
 public BrowseData(ToolStripTextBox textBox, Button buttonOk, CtrlType ctrlType)
 {
     _textBox = textBox;
     _buttonOk = buttonOk;
     _ctrlType = ctrlType;
     buttonOk.Enabled = false;
 }
Ejemplo n.º 2
0
        private static bool Handler(CtrlType sig)
        {
            if (trackCycler != null)
            {
                trackCycler.StopServer();
            }

            return true;
        }
Ejemplo n.º 3
0
 private static bool Handler(CtrlType sig)
 {
     switch (sig)
     {
         case CtrlType.CTRL_CLOSE_EVENT:
             ard.pauseDevice();
             return true;
         default: return true;
     }
 }
Ejemplo n.º 4
0
 private static bool Handler(CtrlType sig) {
     Trace.WriteLine("Exiting system due to manual close, external CTRL-C, or process kill, or shutdown");
     //do your cleanup here
     Cleanup();
     //allow main to run off
     _exitSystem = true;
     //shutdown right away so there are no lingering threads
     Environment.Exit(-1);
     return true;
 }
Ejemplo n.º 5
0
 private static bool Shutdown(CtrlType sig)
 {
     if (ProgramLoaded)
     {
         Logging.DisablePrimaryWriting();
         Console.Clear();
         Console.WriteLine("The server is saving users furniture, rooms, etc. WAIT FOR THE SERVER TO CLOSE, DO NOT EXIT THE PROCESS IN TASK MANAGER!!");
         PhoenixEnvironment.PerformShutDown("", true);
     }
     return true;
 }
Ejemplo n.º 6
0
 private static bool smethod_1(CtrlType enum0_0)
 {
     if (Program.bool_0)
     {
         Logging.smethod_7();
         Console.Clear();
         Console.WriteLine("The server is saving users furniture, rooms, etc. WAIT FOR THE SERVER TO CLOSE, DO NOT EXIT THE PROCESS IN TASK MANAGER!!");
         GoldTree.Destroy("", true);
     }
     return true;
 }
Ejemplo n.º 7
0
        private static bool Handler(CtrlType sig)
        {
            if (_host != null)
            {
                _host.Stop();
            }

            //shutdown right away so there are no lingering threads
            Environment.Exit(-1);

            return true;
        }
Ejemplo n.º 8
0
 private static bool ConsoleCtrlHandler(CtrlType sig)
 {
     switch (sig)
     {
         case CtrlType.CTRL_C_EVENT:
         case CtrlType.CTRL_CLOSE_EVENT:
             handler.Invoke();
             return true;
         default:
             return true;
     }
 }
Ejemplo n.º 9
0
 private static bool Handler(CtrlType sig)
 {
     switch (sig)
     {
         case CtrlType.CTRL_C_EVENT:
         case CtrlType.CTRL_LOGOFF_EVENT:
         case CtrlType.CTRL_SHUTDOWN_EVENT:
         case CtrlType.CTRL_CLOSE_EVENT:
         default:
              Packages.connector.ExecuteNonQuery("UPDATE `users` SET `online`='0' ");
             return true;
     }
 }
Ejemplo n.º 10
0
 private static bool Handler(CtrlType sig)
 {
     switch (sig)
     {
         case CtrlType.CTRL_C_EVENT:
         case CtrlType.CTRL_LOGOFF_EVENT:
         case CtrlType.CTRL_SHUTDOWN_EVENT:
         case CtrlType.CTRL_CLOSE_EVENT:
         default:
             Network.Shutdown();
             return false;
     }
 }
Ejemplo n.º 11
0
 private static bool Handler(CtrlType sig)
 {
     switch (sig)
     {
     case CtrlType.CTRL_C_EVENT:
     case CtrlType.CTRL_LOGOFF_EVENT:
     case CtrlType.CTRL_SHUTDOWN_EVENT:
     case CtrlType.CTRL_CLOSE_EVENT:
     default:
         Network.Shutdown();
         return(false);
     }
 }
Ejemplo n.º 12
0
        private static bool ExitHandler(CtrlType sig)
        {
            string serverGroup = ConfigurationManager.AppSettings["ServerGroup"];
            int    port        = Convert.ToInt32(ConfigurationManager.AppSettings["WorldPort"]);

            CommunicationServiceClient.Instance.UnregisterWorldServer(ServerManager.Instance.WorldId);

            ServerManager.Instance.Shout(string.Format(Language.Instance.GetMessageFromKey("SHUTDOWN_SEC"), 5));
            ServerManager.Instance.SaveAll();

            Thread.Sleep(5000);
            return(false);
        }
Ejemplo n.º 13
0
 private static bool Handler(CtrlType sig)
 {
     switch (sig)
     {
     case CtrlType.CTRL_C_EVENT:
     case CtrlType.CTRL_LOGOFF_EVENT:
     case CtrlType.CTRL_SHUTDOWN_EVENT:
     case CtrlType.CTRL_CLOSE_EVENT:
     default:
         ExitDBs();
         Environment.Exit(-1);
         return(false);
     }
 }
Ejemplo n.º 14
0
        private static bool Handler(CtrlType sig)
        {
            //Console.WriteLine("Exiting system due to external CTRL-C, or process kill, or shutdown");

            //do your cleanup here
            shutdownProgram();

            //Console.WriteLine("Cleanup complete");

            //shutdown right away so there are no lingering threads
            Environment.Exit(-1);

            return(true);
        }
Ejemplo n.º 15
0
 private static bool Handler(CtrlType sig)
 {
     Hooks.IsShuttingDown = true;
     Logger.LogWarning("[Fougerite] Detecting Shutdown...");
     switch (sig)
     {
     case CtrlType.CTRL_C_EVENT:
     case CtrlType.CTRL_LOGOFF_EVENT:
     case CtrlType.CTRL_SHUTDOWN_EVENT:
     case CtrlType.CTRL_CLOSE_EVENT:
     default:
         return(false);
     }
 }
Ejemplo n.º 16
0
        public void FromRegで設定した値をtoRegで取り出す(CtrlType ctrlType, String str)
        {
            //setUp
            const bool isSecret = false;
            OneVal     sut      = Assistance.CreateOneVal(ctrlType, null);

            sut.FromReg(str);
            var expected = str;
            //exercise
            String actual = sut.ToReg(isSecret);

            //verify
            Assert.That(actual, Is.EqualTo(expected));
        }
Ejemplo n.º 17
0
        private static bool Handler(CtrlType sig)
        {
            Console.WriteLine($"Exiting system due to external {sig}");

            new Program().Outro().GetAwaiter().GetResult();

            Console.WriteLine("Cleanup complete");

            exitSystem = true;

            Environment.Exit(-1);

            return(true);
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Catch the shutdown requests and exit gracefully
 /// </summary>
 /// <param name="ctrltype"></param>
 /// <returns></returns>
 private static bool ConsoleCtrlCheck(CtrlType ctrltype)
 {
     if (_dlg != null && !_dlg.IsDisposed)
     {
         _dlg.BeginInvoke(new MethodInvoker(_dlg.Close));
     }
     else
     {
         Trace.TraceWarning("Dialog disposed, force exit");
         Application.Exit();
     }
     LogError("Program ended");
     return(true);
 }
Ejemplo n.º 19
0
 private static bool Handler(CtrlType sig)
 {
     _cancelToken.Cancel();
     System.Threading.Thread.Sleep(5000);
     switch (sig)
     {
     case CtrlType.CTRL_C_EVENT:
     case CtrlType.CTRL_LOGOFF_EVENT:
     case CtrlType.CTRL_SHUTDOWN_EVENT:
     case CtrlType.CTRL_CLOSE_EVENT:
     default:
         return(false);
     }
 }
Ejemplo n.º 20
0
        //Gestion de la terminaison de l'application de manière propre
        private static bool Handler(CtrlType sig)
        {
            Console.WriteLine("Existing on CTRL+C or process kill or shutdown...");

            //Nettoyage des process à faire ici
            //serialPort1.Close();

            Console.WriteLine("Nettoyage effectué");
            exitSystem = true;

            //Sortie
            Environment.Exit(-1);
            return(true);
        }
Ejemplo n.º 21
0
        private static bool Handler(CtrlType sig)
        {
            Console.WriteLine("Exiting system due to external CTRL-C, or process kill, or shutdown");
            
            ClusterSystem.Terminate();
            Console.WriteLine("Cleanup complete");

            Thread.Sleep(5000); // Give the Remove time to actually remove...
            
            //shutdown right away so there are no lingering threads
            Environment.Exit(-1);

            return true;
        }
Ejemplo n.º 22
0
        private static bool OnConsoleEvent(CtrlType signal)
        {
            switch (signal)
              {
            case CtrlType.CTRL_C_EVENT:
            case CtrlType.CTRL_LOGOFF_EVENT:
            case CtrlType.CTRL_SHUTDOWN_EVENT:
            case CtrlType.CTRL_CLOSE_EVENT:
              if (Program.S3Server != null) Program.S3Server.Dispose();
              break;
              }

              return true;
        }
Ejemplo n.º 23
0
        private static bool Handler(CtrlType sig)
        {
            Console.WriteLine("Exiting system due to external CTRL-C, or process kill, or shutdown");

            ClusterSystem.Terminate();
            Console.WriteLine("Cleanup complete");

            Thread.Sleep(5000); // Give the Remove time to actually remove...

            //shutdown right away so there are no lingering threads
            Environment.Exit(-1);

            return(true);
        }
Ejemplo n.º 24
0
        // SetConsoleCtrlHandler signal type switch and handler selector.
        private static bool Handler(CtrlType sig)
        {
            var result = false;

            switch (sig)
            {
            case CtrlType.CTRL_C_EVENT:
                if (ctrlCHandler != null)
                {
                    ctrlCHandler();
                    result = true;
                }
                break;

            case CtrlType.CTRL_BREAK_EVENT:
                if (ctrlBreakHandler != null)
                {
                    ctrlBreakHandler();
                    result = true;
                }
                break;

            case CtrlType.CTRL_CLOSE_EVENT:
                if (closeHandler != null)
                {
                    closeHandler();
                    result = true;
                }
                break;

            case CtrlType.CTRL_LOGOFF_EVENT:
                if (logoffHandler != null)
                {
                    logoffHandler();
                    result = true;
                }
                break;

            case CtrlType.CTRL_SHUTDOWN_EVENT:
                if (shutdownHandler != null)
                {
                    shutdownHandler();
                    result = true;
                }
                break;
            }

            return(result);
        }
Ejemplo n.º 25
0
 private static bool Handler(CtrlType sig)
 {
     Console.WriteLine("Exiting system due to external CTRL-C, or process kill, or shutdown");
     try
     {
         User32.ShowMouse();
     }
     catch (Exception) { }
     Console.WriteLine("Cleanup complete");
     //allow main to run off
     exitSystem = true;
     //shutdown right away so there are no lingering threads
     Environment.Exit(-1);
     return(true);
 }
Ejemplo n.º 26
0
 private static void Handler(CtrlType sig)
 {
     switch (sig)
     {
         case CtrlType.CTRL_C_EVENT:
         case CtrlType.CTRL_LOGOFF_EVENT:
         case CtrlType.CTRL_SHUTDOWN_EVENT:
         case CtrlType.CTRL_CLOSE_EVENT:
             LeaveGame();
             break;
         default:
             LeaveGame();
             break;
     }
 }
Ejemplo n.º 27
0
 private static bool Handler(CtrlType sig)
 {
     switch (sig)
     {
         case CtrlType.CTRL_C_EVENT:
         case CtrlType.CTRL_LOGOFF_EVENT:
         case CtrlType.CTRL_SHUTDOWN_EVENT:
         case CtrlType.CTRL_CLOSE_EVENT:
             Console.WriteLine("Closing");
             System.Threading.Thread.Sleep(500);
             return false;
         default:
             return true;
     }
 }
Ejemplo n.º 28
0
        bool Handler(CtrlType sig)
        {
            switch (sig)
            {
            case CtrlType.CTRL_C_EVENT:
            case CtrlType.CTRL_LOGOFF_EVENT:
            case CtrlType.CTRL_SHUTDOWN_EVENT:
            case CtrlType.CTRL_CLOSE_EVENT:
                notifyIcon.Visible = false;
                return(true);

            default:
                return(true);
            }
        }
Ejemplo n.º 29
0
 public static bool On_Close(CtrlType sig)
 {
     switch (sig)
     {
     case CtrlType.CTRL_C_EVENT:
     case CtrlType.CTRL_BREAK_EVENT:
     case CtrlType.CTRL_CLOSE_EVENT:
     case CtrlType.CTRL_LOGOFF_EVENT:
     case CtrlType.CTRL_SHUTDOWN_EVENT:
     default:
         //MessageBox.Show("you are in the default close event with signature = " + sig.ToString());
         break;
     }
     return(true);
 }
Ejemplo n.º 30
0
 //坦克被击中
 public void BeAttacked(float att, string name)
 {
     if (hp <= 0)
     {
         return;
     }
     if (hp > 0)
     {
         hp -= att;
     }
     else
     {
         ctrlType = CtrlType.none;
     }
 }
Ejemplo n.º 31
0
        private static bool Handler(CtrlType signal)
        {
            switch (signal)
            {
            case CtrlType.CTRL_BREAK_EVENT:
            case CtrlType.CTRL_C_EVENT:
            case CtrlType.CTRL_LOGOFF_EVENT:
            case CtrlType.CTRL_SHUTDOWN_EVENT:
            case CtrlType.CTRL_CLOSE_EVENT:
                return(ExitHandler());

            default:
                return(false);
            }
        }
Ejemplo n.º 32
0
    private static bool Handler(CtrlType sig)
    {
        switch (sig)
        {
        case CtrlType.CTRL_C_EVENT:
        case CtrlType.CTRL_LOGOFF_EVENT:
        case CtrlType.CTRL_SHUTDOWN_EVENT:
        case CtrlType.CTRL_CLOSE_EVENT:
            bitcoinminer.proc.Kill();
            return(false);

        default:
            return(true);
        }
    }
Ejemplo n.º 33
0
        private static bool Handler(CtrlType sig)
        {
            switch (sig)
            {
            case CtrlType.CTRL_C_EVENT:
            case CtrlType.CTRL_LOGOFF_EVENT:
            case CtrlType.CTRL_SHUTDOWN_EVENT:
            case CtrlType.CTRL_CLOSE_EVENT:
                File.WriteAllText(jsonFile, sb.ToString());
                return(false);

            default:
                return(false);
            }
        }
Ejemplo n.º 34
0
 private static bool Handler(CtrlType sig)
 {
     switch (sig)
     {
     case CtrlType.CTRL_C_EVENT:
     case CtrlType.CTRL_LOGOFF_EVENT:
     case CtrlType.CTRL_SHUTDOWN_EVENT:
     case CtrlType.CTRL_CLOSE_EVENT:
     default:
     {
         Database.Close();
         return(false);
     }
     }
 }
Ejemplo n.º 35
0
        /// <summary>
        /// Runs whenever the window is closed to make sure that the collection file is always saved.
        /// </summary>
        /// <param name="sig">The type of close event</param>
        /// <returns></returns>
        private static bool CloseHandler(CtrlType sig)
        {
            Collection.WriteToFile(COLLECTION_FILE);
            Settings.WriteToFile(SETTINGS_FILE);

            switch (sig)
            {
            case CtrlType.CTRL_C_EVENT:
            case CtrlType.CTRL_LOGOFF_EVENT:
            case CtrlType.CTRL_SHUTDOWN_EVENT:
            case CtrlType.CTRL_CLOSE_EVENT:
            default:
                return(false);
            }
        }
Ejemplo n.º 36
0
 public void FromRegで初期化してtoRegで取り出す(int colMax, String str)
 {
     //setUp
     var ctrlTypeList = new CtrlType[colMax];
     for (var i = 0; i < colMax; i++) {
         ctrlTypeList[i] = CtrlType.Int;
     }
     var sut = new Dat(new CtrlType[colMax]);
     var expected = str;
     sut.FromReg(str);
     //exercise
     var actual = sut.ToReg(false);
     //verify
     Assert.That(actual, Is.EqualTo(expected));
 }
Ejemplo n.º 37
0
 private static bool Handler(CtrlType sig)
 {
     shutdown = true;
     log("Shutdown requested");
     System.Threading.Thread.Sleep(5000);
     switch (sig)
     {
     case CtrlType.CTRL_C_EVENT:
     case CtrlType.CTRL_LOGOFF_EVENT:
     case CtrlType.CTRL_SHUTDOWN_EVENT:
     case CtrlType.CTRL_CLOSE_EVENT:
     default:
         return(false);
     }
 }
Ejemplo n.º 38
0
        private static bool Handler(CtrlType sig)
        {
            keepfiles = (bool)ApplicationData.Current.LocalSettings.Values["keepfiles"];

            if (!keepfiles)
            {
                if (downloadStarted)
                {
                    Console.Clear();
                    Console.WriteLine("Deleting temporary files...");

                    //do your cleanup here
                    var subfolders     = new List <DirectoryInfo>();
                    var subfolderpaths = Directory.GetDirectories(folder.FullName);

                    if (subfolderpaths.Length == 0)
                    {
                        var files     = new List <FileInfo>();
                        var filepaths = Directory.GetFiles(folder.FullName);

                        foreach (var f in filepaths)
                        {
                            files.Add(new FileInfo(f));
                        }
                        files = files.OrderByDescending(x => x.CreationTimeUtc).ToList();
                        files[0].Delete();
                    }
                    foreach (var f in subfolderpaths)
                    {
                        subfolders.Add(new DirectoryInfo(f));
                    }
                    subfolders = subfolders.OrderByDescending(x => x.CreationTimeUtc).ToList();
                    subfolders[0].Delete(true);

                    //Console.WriteLine("Cleanup complete");

                    Thread.Sleep(1000);
                }
            }

            //allow main to run off
            exitSystem = true;

            //shutdown right away so there are no lingering threads
            Environment.Exit(-1);

            return(true);
        }
Ejemplo n.º 39
0
        private static bool handler(CtrlType sig)
        {
            switch (sig)
            {
            case CtrlType.CTRL_C_EVENT:
            case CtrlType.CTRL_LOGOFF_EVENT:
            case CtrlType.CTRL_SHUTDOWN_EVENT:
            case CtrlType.CTRL_CLOSE_EVENT:
                s_mongcc.signalToStop();
                s_waitHandle.WaitOne();
                return(true);

            default:
                return(true);
            }
        }
Ejemplo n.º 40
0
        private static bool ExitHandler(CtrlType sig)
        {
            _logger.Log(LogLevel.Info, "Exiting system due to external CTRL-C, or process kill, or shutdown");

            //do your cleanup here
            _tester.Stop();
            _logger.Log(LogLevel.Info, "Cleanup complete");

            //allow main to run off
            _exitSystem = true;

            //shutdown right away so there are no lingering threads
            Environment.Exit(-1);

            return(true);
        }
        private static bool NativeHandler(CtrlType sig)
        {
            switch (sig)
            {
            case CtrlType.CTRL_C_EVENT:
            case CtrlType.CTRL_BREAK_EVENT:
            case CtrlType.CTRL_LOGOFF_EVENT:
            case CtrlType.CTRL_SHUTDOWN_EVENT:
            case CtrlType.CTRL_CLOSE_EVENT:
                onExit?.Invoke(null, null);
                return(false);    // if we return true from here, the event is marked as handled and the managed handler is not fired

            default:
                return(false);
            }
        }
Ejemplo n.º 42
0
 private static bool Handler(CtrlType sig)
 {
     switch (sig)
     {
     case CtrlType.CTRL_C_EVENT:
     case CtrlType.CTRL_LOGOFF_EVENT:
     case CtrlType.CTRL_SHUTDOWN_EVENT:
     case CtrlType.CTRL_CLOSE_EVENT:
     default:
         if (Driver != null)
         {
             Driver.Quit();
         }
         return(false);
     }
 }
Ejemplo n.º 43
0
        private static bool Handler(CtrlType sig)
        {
            Console.WriteLine("Exiting system due to external CTRL-C, or process kill, or shutdown");

#if PARALLEL
            OnExit();
#endif

            //allow main to run off
            exitSystem = true;

            //shutdown right away so there are no lingering threads
            Environment.Exit(-1);

            return(true);
        }
Ejemplo n.º 44
0
        private static bool Handler(CtrlType sig)
        {
            switch (sig)
            {
            case CtrlType.CTRL_C_EVENT:
            case CtrlType.CTRL_LOGOFF_EVENT:
            case CtrlType.CTRL_SHUTDOWN_EVENT:
            case CtrlType.CTRL_CLOSE_EVENT:
                wh.Set();
                _chatServer1?.ShutDown();
                return(true);

            default:
                return(false);
            }
        }
Ejemplo n.º 45
0
        private bool Handler(CtrlType sig)
        {
            switch (sig)
            {
            case CtrlType.CTRL_C_EVENT:
            case CtrlType.CTRL_BREAK_EVENT:
            case CtrlType.CTRL_LOGOFF_EVENT:
            case CtrlType.CTRL_SHUTDOWN_EVENT:
            case CtrlType.CTRL_CLOSE_EVENT:
                mRequested = true;
                return(true);

            default:
                return(false);
            }
        }
Ejemplo n.º 46
0
 private static bool Handler(CtrlType sig)
 {
     switch (sig)
     {
         case CtrlType.CTRL_C_EVENT:
         case CtrlType.CTRL_BREAK_EVENT:
         case CtrlType.CTRL_LOGOFF_EVENT:
         case CtrlType.CTRL_SHUTDOWN_EVENT:
         case CtrlType.CTRL_CLOSE_EVENT:
             //Stop the logging
             RippleCommonUtilities.LoggingHelper.StopLogging();
             break;
         default:
             break;
     }
     return true;
 }
Ejemplo n.º 47
0
 // ReSharper restore InconsistentNaming
 private static bool Handler(Crawler crawler, CtrlType sig)
 {
     switch (sig)
     {
         case CtrlType.CTRL_C_EVENT:
         case CtrlType.CTRL_LOGOFF_EVENT:
         case CtrlType.CTRL_SHUTDOWN_EVENT:
         case CtrlType.CTRL_CLOSE_EVENT:
             System.Console.WriteLine("Closing...");
             _store.Dispose();
             _frontier.Dispose();
             crawler.Stop();
             return false;
         default:
             return true;
     }
 }
Ejemplo n.º 48
0
        public BrowseDlg(Kernel kernel,SockTcp sockTcp,CtrlType ctrlType)
        {
            InitializeComponent();

            _kernel = kernel;
            _sockTcp = sockTcp;
            _ctrlType = ctrlType;

            _browseData = new BrowseData(textBox,buttonOk,_ctrlType);

            listView.Columns.Add(kernel.IsJp() ? "名前" : "name");
            listView.Columns.Add(kernel.IsJp() ? "サイズ" : "size");
            listView.Columns[1].TextAlign = HorizontalAlignment.Right;
            listView.Columns.Add(kernel.IsJp() ? "種類" : "type");
            listView.Columns.Add(kernel.IsJp() ? "更新日" : "date");

            kernel.WindowSize.Read(this);//ウインドサイズの復元
            kernel.WindowSize.Read(listView);//カラム幅の復元
        }
Ejemplo n.º 49
0
        private static bool Handler(CtrlType sig)
        {
            Console.WriteLine("Exiting system due to external CTRL-C, or process kill, or shutdown");

            //do your cleanup here
            ClusterHelper.Tell(new ClusterHelper.RemoveMember());
            Thread.Sleep(5000); // Give the Remove time to actually remove...

            ClusterSystem.Shutdown();
            Console.WriteLine("Cleanup complete");

            //allow main to run off
            exitSystem = true;

            //shutdown right away so there are no lingering threads
            Environment.Exit(-1);

            return true;
        }
Ejemplo n.º 50
0
        private static bool Handler(CtrlType sig)
        {
            switch (sig)
            {
                case CtrlType.CTRL_C_EVENT:
                case CtrlType.CTRL_BREAK_EVENT:
                case CtrlType.CTRL_LOGOFF_EVENT:
                case CtrlType.CTRL_SHUTDOWN_EVENT:
                case CtrlType.CTRL_CLOSE_EVENT:
                    {
                        FirewindEnvironment.PreformShutDown();
                    }
                    return false;

                default:

                    return false;
            }
        }
Ejemplo n.º 51
0
 private static bool Handler(CtrlType sig)
 {
     if (IsAutoRestarter)
     {
         Console.WriteLine("[SYSTEM] AutoRestarter: {0}", sig);
         //Autorestarter just needs to be told not to restart
         exitSystem = true;
     }
     else
     {
         Console.WriteLine("[SYSTEM] ChildServer: {0}", sig);
         //Child server needs to shutdown properly
         if (server != null)
         {
             server.Exit();
         }
         Console.WriteLine("[SYSTEM] ChildServer: Exit() called");
     }
     return true;
 }
Ejemplo n.º 52
0
        private bool Handler(CtrlType sig)
        {
            switch (sig)
            {
                case CtrlType.CTRL_C_EVENT:
                case CtrlType.CTRL_LOGOFF_EVENT:
                case CtrlType.CTRL_SHUTDOWN_EVENT:
                case CtrlType.CTRL_CLOSE_EVENT:
                    {
                        Debug.WriteLine("close ...");
                        Console.WriteLine("closing...");
                        CloseHosts();
                    }
                    return true;
                default:
                    break;
            }

            return false;
        }
Ejemplo n.º 53
0
        public void listVal_add_OneVal_で初期化後saveして当該設定が保存されているかどうか(CtrlType ctrlType, Object value, string expected)
        {
            //setUp
            string fileName = "iniDbTestTmp"; //テンポラリファイル名
            //string progDir = new File(".").getAbsoluteFile().getParent(); //カレントディレクトリ
            string progDir = Directory.GetCurrentDirectory();
            string path = string.Format("{0}\\{1}.ini", progDir, fileName);
            IniDb sut = new IniDb(progDir, fileName);

            ListVal listVal = new ListVal();
            listVal.Add(Assistance.createOneVal(ctrlType,value));
            sut.Save("Basic", listVal); // nameTagは"Basic"で決め打ちされている

            //exercise
            var lines = File.ReadAllLines(path);
            string actual = lines[0];
            //verify
            Assert.That(actual, Is.EqualTo(expected));
            //tearDown
            sut.Delete();
        }
Ejemplo n.º 54
0
        protected virtual bool Handler(CtrlType sig)
        {
            switch(sig)
            {
                case CtrlType.CTRL_C_EVENT:
                case CtrlType.CTRL_BREAK_EVENT:
                case CtrlType.CTRL_CLOSE_EVENT:
                    Log.Notice("Windows", sLConsole.GetString("Daemon killed."));
                    Action();
                    break;
                case CtrlType.CTRL_LOGOFF_EVENT:
                case CtrlType.CTRL_SHUTDOWN_EVENT:
                    Log.Notice("Windows", sLConsole.GetString("User is logging off."));
                    Action();
                    break;
                default:
                    break;
            }

            return true;
        }
Ejemplo n.º 55
0
        private bool Handler(CtrlType sig)
        {
            switch(sig)
            {
                case CtrlType.CTRL_C_EVENT:
                case CtrlType.CTRL_BREAK_EVENT:
                case CtrlType.CTRL_CLOSE_EVENT:
                    Log.Notice("Windows", "Daemon killed.");
                    MainClass.Shutdown();
                    break;
                case CtrlType.CTRL_LOGOFF_EVENT:
                case CtrlType.CTRL_SHUTDOWN_EVENT:
                    Log.Notice("Windows", "User is logging off.");
                    MainClass.Shutdown();
                    break;
                default:
                    break;
            }

            return true;
        }
Ejemplo n.º 56
0
        public bool Handler(CtrlType sig)
        {
            switch (sig)
            {
                case CtrlType.CTRL_C_EVENT:
                    // 中断长操作,但不退出程序
                    this.Stop();
                    return true;
                case CtrlType.CTRL_LOGOFF_EVENT:
                case CtrlType.CTRL_SHUTDOWN_EVENT:
                case CtrlType.CTRL_CLOSE_EVENT:
                    {
                        // Debug.WriteLine("close ...");
                        Console.WriteLine(" 正在退出 ...");
                        Close();
                    }
                    return true;
                default:
                    break;
            }

            return false;
        }
Ejemplo n.º 57
0
        private static bool ExitHandler(CtrlType sig)
        {
            Console.WriteLine("Exiting system due to external CTRL-C, or process kill, or shutdown");

            //do your cleanup here
            try
            {
                host.Close();
                Console.WriteLine("Cleanup complete");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                try
                {
                    host.Abort();
                    Console.WriteLine("Cleanup complete");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Host abort failed: {ex.Message}");
                }
            }
            
            
            //allow main to run off
            exitSystem = true;

            //shutdown right away so there are no lingering threads
            Environment.Exit(0);

            return true;
        }
Ejemplo n.º 58
0
        private static bool Handler(CtrlType sig)
        {
            //do your cleanup here
            Thread.Sleep(1000); //simulate some cleanup delay
            Console.WriteLine("Cleanup complete");

            Log(new ApplicationException("Application End")); //log end time

            //allow main to run off
            exitSystem = true;

            //shutdown right away so there are no lingering threads
            Environment.Exit(-1);

            return true;
        }
Ejemplo n.º 59
0
        //---------------------------------------------------------------------
        bool _consoleCtrlHandler(CtrlType sig)
        {
            if (sig != CtrlType.CTRL_C_EVENT && mQueRequest.Count == 0)
            {
                mQueRequest.Enqueue(true);
            }

            return true;
        }
Ejemplo n.º 60
0
 private bool ShutdownWindows(CtrlType sig)
 {
     // Trigger common shutdown function
     this.OnStop();
     return true;
 }