Inheritance: MonoBehaviour
コード例 #1
0
 public static void ToggleDeveloperConsole()
 {
     if ((console != null) && GnomanEmpire.Instance.GuiManager.Manager.Controls.Contains(console))
     {
         GnomanEmpire.Instance.GuiManager.Remove(console);
         console = null;
     }
     else
     {
         GnomanEmpire.Instance.GuiManager.Add(console = new ConsoleWindow(GnomanEmpire.Instance.GuiManager.Manager));
     }
 }
コード例 #2
0
        public void PrintToConsole(WindowsManager windowsManager, ConsoleWindow console)
        {
            var currentState = windowsManager.GetCurrentState();

            for (int row = 0; row < Engine.ConsoleHeight; row++)
            {
                for (int col = 0; col < Engine.ConsoleWidth; col++)
                {
                    //nooo need to check if there is actual change in the cell we are writing, the console does that on its own
                    console.Write(row, col, currentState[row][col].Value, currentState[row][col].Color,
                                  currentState[row][col].BackgroundColor);
                }
            }
        }
コード例 #3
0
        public static void Main()
        {
            ConsoleWindow.CustomizeConsole();

            Wall wall = new Wall(60, 20);
            //Food food = new FoodAsterisk(wall);
            //food.SetRandomFoodPosition(new Queue<Point>());

            Snake snake = new Snake(wall);

            Engine engine = new Engine(wall, snake);

            engine.Run();
        }
コード例 #4
0
        public void With_ConsoleLogSink_Write_does_not_throw_an_exception()
        {
            var consoleLogSink = new ConsoleWindow();

            try
            {
                consoleLogSink.Write(LogEntry.Entry("Hello World"));
                Assert.IsTrue(true);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: DistResearch/spacebux-pool
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; // Catch any unhandled exceptions if we are in release mode.

            // use invariant culture - we have to set it explicitly for every thread we create to
            // prevent any file-reading problems (mostly because of number formats).
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            // start the ioc kernel.
            var kernel = TinyIoCContainer.Current;

            new Bootstrapper(kernel);
            var objectFactory = kernel.Resolve <IObjectFactory>();
            var configFactory = kernel.Resolve <IConfigFactory>();

            // print intro texts.
            ConsoleWindow.PrintBanner();
            ConsoleWindow.PrintLicense();

            // load the config-manager.
            var configManager = configFactory.GetConfigManager();

            // initialize log-manager as we'll need it below.
            objectFactory.GetLogManager();

            // print a version banner.
            _logger = Log.ForContext <Program>();
            _logger.Information("SpacebuxServ {0:l} {1:l} warming-up..", VersionInfo.CodeName, Assembly.GetAssembly(typeof(Program)).GetName().Version);
            PlatformManager.PrintPlatformBanner();

            // initialize config manager.
            configManager.Initialize();

            // initialize metrics support
            objectFactory.GetMetricsManager();

            // start pool manager.
            var poolManager = objectFactory.GetPoolManager();

            poolManager.Run();

            // start web server.
            objectFactory.GetWebServer();

            while (true) // idle loop & command parser
            {
                var line = Console.ReadLine();
                CommandManager.Parse(line);
            }
        }
コード例 #6
0
        private void MoveConsoleWindow()
        {
            if (!this.IsLoaded)
            {
                return;
            }
            ConsoleWindow consoleWindow = ConsoleWindow.Instance;

            if (!this.IsVisible || this.WindowState == WindowState.Minimized)
            {
                consoleWindow.Hide();
                return;
            }
            if (!consoleWindow.IsVisible)
            {
                consoleWindow.Show();
            }
            if (consoleWindow.WindowState != this.WindowState)
            {
                consoleWindow.WindowState = this.WindowState;
            }
            // -2 -1是因为主窗口有圆角,但下层的控制台窗口不能透明所以不能圆角,把下层的控制台窗口的宽高缩小一点点从而避免看见下层控制台窗口的棱角
            if (consoleWindow.Width != this.Width - 2)
            {
                consoleWindow.Width = this.Width - 2;
            }
            if (consoleWindow.Height != this.Height - 2)
            {
                consoleWindow.Height = this.Height - 2;
            }
            if (this.WindowState == WindowState.Normal)
            {
                if (consoleWindow.Left != this.Left + 1)
                {
                    consoleWindow.Left = this.Left + 1;
                }
                if (consoleWindow.Top != this.Top + 1)
                {
                    consoleWindow.Top = this.Top + 1;
                }
            }
            if (ConsoleRectangle != null && ConsoleRectangle.IsVisible)
            {
                Point     point       = ConsoleRectangle.TransformToAncestor(this).Transform(new Point(0, 0));
                const int paddingLeft = 4;
                int       marginLeft  = paddingLeft + (int)point.X;
                int       width       = (int)(ConsoleRectangle.ActualWidth - paddingLeft);
                consoleWindow.MoveWindow(marginLeft: marginLeft, marginTop: (int)point.Y, width, height: (int)ConsoleRectangle.ActualHeight + 1);
            }
        }
コード例 #7
0
 private void buttonOpenConsole_Click(object sender, EventArgs e)
 {
     if (!ConsoleWindow.Allocated)
     {
         ConsoleWindow.Allocate();
     }
     else if (!ConsoleWindow.Displayed)
     {
         ConsoleWindow.Show();
     }
     else
     {
         ConsoleWindow.Hide();
     }
 }
コード例 #8
0
        static IGameUnit CreateHelp()
        {
            var text = new [] {
                "H                     - Toggle this Help",
                "F1                    - Show About",
                "Esc                   - Exit",
                "Left, Right, Up, Down - Move",
                "W,E                   - Rotate",
                "S                     - Restart",
                "Plus|Minus            - Increase|Decrease Step",
            };
            var help = new ConsoleWindow(background, text);

            return(help);
        }
コード例 #9
0
 public SimulatorPanel(string simName, int index, ConsoleWindow cw, BusinessSettings bs, Booking b)
 {
     InitializeComponent();
     SimPanelIndex = index;
     origin        = cw;
     this.bs       = bs;
     SetTheme();
     BorderColor = bs.GetTheme().BorderColor;
     UpdateNameLabel(simName);
     hasBooking = b != null;
     ApplyClickHandles();
     this.b = b;
     SetNextBooking(b, false);
     this.SetStyle(ControlStyles.UserPaint, true);
 }
コード例 #10
0
ファイル: ConsoleWindow.cs プロジェクト: rinavin/RCJS
 /// <summary>
 ///   Returns the instance of this singleton class
 /// </summary>
 /// <returns>
 /// </returns>
 internal static ConsoleWindow getInstance()
 {
     if (_instance == null)
     {
         lock (typeof(ConsoleWindow))
         {
             if (_instance == null)
             {
                 _instance = new ConsoleWindow();
                 hookStandards();
             }
         }
     }
     return(_instance);
 }
コード例 #11
0
 private static void reshow()
 {
     close();
     window = new ConsoleWindow();
     if (lines_length != null)
     {
         window.lines_length = lines_length.Value;
     }
     window.Show();
     window_closed  = false;
     window.Closed += (sender, e) =>
     {
         window_closed = true;
     };
 }
コード例 #12
0
            /// <summary>
            /// Constructor.
            /// </summary>
            /// <param name="commandLine">The raw command line arguments passed to the program.</param>
            public ConsoleProgram(string[] commandLine)
            {
                CommandLine = commandLine;
                Handlers    = new Dictionary <string, ConsoleActionData>();

                //Try to parse the command line for a Quiet argument.
                Arguments = new ConsoleArguments();
                Args.Parse(commandLine, CommandLinePrefixes, CommandLineSeparators, Arguments);

                //Create the console window if we don't have the quiet argument.
                if (!Arguments.Quiet)
                {
                    ConsoleWindow = new ConsoleWindow();
                }
            }
コード例 #13
0
        private void ConsoleBtn_Click(object sender, RoutedEventArgs e)
        {
            if (_consoleWindow != null && _consoleWindow.IsShown && !_consoleWindow.CommandShutdown)
            {
                _consoleWindow.Focus();
            }
            else
            {
                _consoleWindow = new ConsoleWindow(this);
                VersatileIO.SetHandler(_consoleWindow.Handler);
                VersatileIO.MinLogLevel = LogLevel.Verbose;

                _consoleWindow.Show();
            }
        }
コード例 #14
0
ファイル: Chainloader.cs プロジェクト: arocarlisle/BepInEx
        /// <summary>
        /// Initializes BepInEx to be able to start the chainloader.
        /// </summary>
        public static void Initialize(string containerExePath, bool startConsole = true)
        {
            if (_initialized)
            {
                return;
            }

            //Set vitals
            Paths.SetExecutablePath(containerExePath);

            Paths.SetPluginPath(ConfigPluginsDirectory.Value);

            //Start logging

            if (startConsole)
            {
                ConsoleWindow.Attach();

                ConsoleEncoding.ConsoleCodePage = (uint)Encoding.UTF8.CodePage;
                Console.OutputEncoding          = Encoding.UTF8;
                Logger.Listeners.Add(new ConsoleLogListener());
            }

            //Fix for standard output getting overwritten by UnityLogger
            if (ConsoleWindow.StandardOut != null)
            {
                Console.SetOut(ConsoleWindow.StandardOut);
            }


            Logger.Listeners.Add(new UnityLogListener());
            Logger.Listeners.Add(new DiskLogListener());

            if (!TraceLogSource.IsListening)
            {
                Logger.Sources.Add(TraceLogSource.CreateSource());
            }

            if (ConfigUnityLogging.Value)
            {
                Logger.Sources.Add(new UnityLogSource());
            }


            Logger.LogMessage("Chainloader ready");

            _initialized = true;
        }
コード例 #15
0
        private void SetupWindow(int windowWidth, int windowHeight, Dictionary <string, Simulator> sims, ConsoleWindow cw, DateTime dt)
        {
            InitializeComponent();
            bs = db.PullBusinessSettings();
            SetTheme();
            origin = cw;
            dateTimePicker1.Value = dt;
            dateLabel.Text        = dateTimePicker1.Value.ToString("MMM dd, yyyy");
            this.Width            = windowWidth;
            this.Height           = windowHeight - 10;
            this.sims             = sims;

            dateTimePicker1.ValueChanged += DateTimeChanged;

            GenerateTimeSlots();
        }
コード例 #16
0
        public static string ToggleView(EConsoleView InView)
        {
            if (ConsoleWindow.HasInstance())
            {
                if (InView == EConsoleView.PC)
                {
                    ConsoleWindow.instance.ChangeToPCView();
                }
                else if (InView == EConsoleView.Mobile)
                {
                    ConsoleWindow.instance.ChangeToMobileView();
                }
            }

            return(CheatCommandBase.Done);
        }
コード例 #17
0
 /// <summary>
 /// Activates when you send a command
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SendCommandButton_Click(object sender, EventArgs e)
 {
     if (CommandInput.Text.Trim() != "" && ServerManager.MinecraftServer != null)
     {
         ServerManager.HistoryIndex = -1;
         ServerManager.MinecraftServer.StandardInput.WriteLine(CommandInput.Text);
         ServerManager.MinecraftServer.StandardInput.FlushAsync();
         ConsoleWindow.SelectionColor = Color.Cyan;
         ServerManager.SentCommandsList.Add(CommandInput.Text);
         string timestring = DateTime.Now.ToString("M/d HH:mm:ss");
         ConsoleWindow.AppendText(string.Format("\r\n[{0}]: {1}", timestring, CommandInput.Text));
         ConsoleWindow.ScrollToCaret();
         ConsoleWindow.SelectionColor = Color.White;
         CommandInput.Text            = "";
     }
 }
コード例 #18
0
        public static void Main()
        {
            ConsoleWindow.CustomizeConsole();

            Wall  wall  = new Wall(60, 20);
            Snake snake = new Snake(wall);

            string copyRightText = "Snake game by SoftUni @ C# OOP";

            Console.SetCursorPosition(wall.LeftX - copyRightText.Length, wall.TopY + 1);
            Console.Write(copyRightText);

            Engine engine = new Engine(wall, snake);

            engine.Run();
        }
コード例 #19
0
ファイル: Patch_Console.cs プロジェクト: nasa03/demystify
            public StacktracePatch()
            {
                DemystifySettingsProvider.ThemeEditedOrChanged += Repaint;

                void Repaint()
                {
                    lastText = null;
                    if (ConsoleWindowType != null)
                    {
                        if (ConsoleWindow)
                        {
                            ConsoleWindow.Repaint();
                        }
                    }
                };
            }
コード例 #20
0
ファイル: Program.cs プロジェクト: ReneVogt/ConControls
        static async Task Main()
        {
            TaskCompletionSource <int> windowCompletion = new TaskCompletionSource <int>();

            using var window = new ConsoleWindow();
            using (window.DeferDrawing())
            {
                var examples = from type in Assembly.GetExecutingAssembly().GetTypes()
                               where type.BaseType == typeof(Example)
                               orderby type.Name
                               select(Example) Activator.CreateInstance(type);

                var buttons = examples.Select((example, i) =>
                {
                    var button = new Button(window)
                    {
                        Area   = new Rectangle(0, 3 * i, example.GetType().Name.Length + 4, 3),
                        Tag    = example,
                        Text   = example.GetType().Name,
                        Parent = window
                    };
                    button.Click += OnButtonClick;
                    return(button);
                });
                window.Controls.AddRange(buttons.Cast <ConsoleControl>().ToArray());
                var btClose = new Button(window)
                {
                    Text = "Close", Area = new Rectangle(0, 3 * window.Controls.Count, 9, 3)
                };
                btClose.Click += (sender, e) => windowCompletion.SetResult(0);
                window.Controls.Add(btClose);
            }

            await windowCompletion.Task;

            async void OnButtonClick(object sender, EventArgs e)
            {
                window !.Dispose();
                var button = (Button)sender;

                if (button.Tag is Example example)
                {
                    await example.RunAsync();
                }
                windowCompletion.SetResult(0);
            }
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: CloneDeath/ArmeniRpg
        public static void Main()
        {
            var console = new ConsoleWindow
            {
                Title = "Armeni Rpg",
                DefaultForegroundColor = ConsoleColor.White,
                DefaultBackgroundColor = ConsoleColor.Black
            };

            console.Clear();
            console.Render();

            var engine = GetGameEngine();

            engine.Player = new PlayerFactory().CreatePlayer(console);
            engine.Run(console);
        }
コード例 #22
0
 private void CaptureLog(string log, string stacktrace, LogType type)
 {
     if (!Application.isPlaying)
     {
         return;
     }
     if (log.StartsWith("This uLink evaluation license is temporary."))
     {
         return;
     }
     if (log.StartsWith("Failed to capture screen shot"))
     {
         return;
     }
     if (type != LogType.Log)
     {
         this.AddText(string.Concat("[color #ff0000]> ", log, "[/color]"), false);
     }
     else
     {
         this.AddText(string.Concat("[color #eeeeee]> ", log, "[/color]"), false);
     }
     if (log.StartsWith("Resynchronize Clock is still in progress"))
     {
         return;
     }
     if (type == LogType.Exception || type == LogType.Error)
     {
         if (stacktrace.Length <= 8)
         {
             string str = StackTraceUtility.ExtractStackTrace();
             if (str.Length <= 8)
             {
                 ConsoleWindow.Client_Error(log, (new StackTrace()).ToString());
             }
             else
             {
                 ConsoleWindow.Client_Error(log, str);
             }
         }
         else
         {
             ConsoleWindow.Client_Error(log, stacktrace);
         }
     }
 }
コード例 #23
0
        static void Main(string[] args)
        {
            ConsoleWindow.Allocate();

            if (Array.IndexOf(args, "--with-console") < 0)
            {
                ConsoleWindow.Hide();
            }

            Trace.WriteLine(EntryAssemblyInformation.Title + " Version " + EntryAssemblyInformation.Version);
            ConsoleWindow.SetIcon(Properties.Resources.icon);
            Console.Title = EntryAssemblyInformation.Title + " log";

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Forms.MainForm());
        }
コード例 #24
0
        private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            LexicalAnalyse.Analyser lexicalAnalyser = new LexicalAnalyse.Analyser();
            lexicalAnalyser.Parse(GetTextFromRichTextbox());

            try
            {
                if (AnalyzeType.Equals("pushdownAutomation"))
                {
                    PushdownAutomatonMethod.Analyser analyser = new PushdownAutomatonMethod.Analyser();
                    analyser.Parse();
                }
                else if (AnalyzeType.Equals("recursiveDescent"))
                {
                    RecursiveDescentMethod.Analyser analyser = new RecursiveDescentMethod.Analyser();

                    if (analyser.Parse())
                    {
                        listViewErrors.ItemsSource = null;

                        IPolishGenerator generator = new DeijkstraGenerator();
                        generator.Start();

                        ConsoleWindow consoleWindow = new ConsoleWindow();
                        consoleWindow.Show();

                        Executor polishExecutor = new Executor(generator, consoleWindow);
                        polishExecutor.Execute();
                    }
                    else
                    {
                        listViewErrors.ItemsSource = analyser.GetErrors();
                    }
                }
                else if (AnalyzeType.Equals("operatorPrecedence"))
                {
                    OperatorPrecedenceMethod.Analyser analyser = new OperatorPrecedenceMethod.Analyser();
                    analyser.Parse();
                    MessageBox.Show("Build successfully.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #25
0
ファイル: StartUp.cs プロジェクト: TTashev/Snake-Game
        public static void Main()
        {
            Position pos  = new Position(5, 5);
            Position pos2 = new Position(5, 5);

            ConsoleWindow.CustomizeConsole();

            Position    boardPosition = new Position(GameData.LevelBoarder.defaultBoarderWidth, GameData.LevelBoarder.defaultBoarderHeight);
            DrawManager drawManager   = new DrawManager();
            Snake       snake         = new Snake();


            //string[] lines = System.IO.File.ReadAllLines(@"C:\Users\Redeemer\Desktop\New Text Document (2).txt");

            Engine engine = new Engine(drawManager, snake, boardPosition);

            engine.Run();
        }
コード例 #26
0
ファイル: DrawingSystem.cs プロジェクト: HriGunov/RogueLike
 public void Render(ConsoleWindow console, char[][] view)
 {
     view[view.Length / 2][view.Length / 2] = '@';
     for (int y = 0; y < view.Length; y++)
     {
         for (int x = 0; x < view[y].Length; x++)
         {
             if (view[y][x] != '!')
             {
                 console.Write(y, x, view[y][x], Color4.White);
             }
             else
             {
                 console.Write(y, x, view[y][x], Color4.Red);
             }
         }
     }
 }
コード例 #27
0
ファイル: Program.cs プロジェクト: hydezeke/paleonoid
        static void Main(string[] args)
        {
            ConsoleWindow console = new ConsoleWindow(16, 40, "paleonoid");
            int           x       = 0;
            int           y       = 0;

            while (true)
            {
                x++;
                if (x > 16)
                {
                    x = 0;
                    y++;
                }
                console.WindowUpdate();
                console.Write(x, y, '+', Color4.Red, new Color4(0f, 0f, 0f, 0f));
            }
        }
コード例 #28
0
 // Constructor
 public Engine(ConsoleWindow console, WindowsManager windowsManager,
               ILogger logger, CombatManager combatManager,
               KeyHandler keyHandler, Visualization visualization,
               Movement movement, SelectablePopUpWindow inventoryWindow,
               Random randomProvider, IMathFunctions math
               )
 {
     this.console         = console;
     this.windowsManager  = windowsManager;
     this.logger          = logger;
     this.combatManager   = combatManager;
     this.visualization   = visualization;
     this.keyHandler      = keyHandler;
     this.inventoryWindow = inventoryWindow;
     this.movement        = movement;
     this.randomProvider  = randomProvider;
     this.math            = math;
 }
コード例 #29
0
 /// <summary>
 /// Activates when you send a command
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SendCommandButton_Click(object sender, RoutedEventArgs e)
 {
     if (ServerManager.MinecraftServer == null)
     {
         StartServer();
     }
     else if (CommandInput.Text.Trim() != "")
     {
         ServerManager.HistoryIndex = -1;
         ServerManager.MinecraftServer.StandardInput.WriteLine(CommandInput.Text);
         ServerManager.MinecraftServer.StandardInput.FlushAsync();
         ServerManager.SentCommandsList.Add(CommandInput.Text);
         string timestring = DateTime.Now.ToString("M/d HH:mm:ss");
         ConsoleWindow.AppendColoredText(string.Format("\r[{0}]: {1}", timestring, CommandInput.Text), new SolidColorBrush(Color.FromRgb(62, 80, 180)));
         ConsoleWindow.ScrollToEnd();
         CommandInput.Text = "";
     }
 }
コード例 #30
0
 private void CheckBeltUsage()
 {
     if ((!UIUnityEvents.shouldBlockButtonInput && base.enabled) && !ConsoleWindow.IsVisible())
     {
         Inventory inventory = this.inventory;
         if (inventory != null)
         {
             InventoryHolder inventoryHolder = inventory.inventoryHolder;
             if (inventoryHolder != null)
             {
                 int beltNum = InputSample.PollItemButtons();
                 if (beltNum != -1)
                 {
                     inventoryHolder.BeltUse(beltNum);
                 }
             }
         }
     }
 }
コード例 #31
0
        static Log()
        {
            try
            {
                var log_dir = SettingManager.LoadSetting <GlobalSetting>().LogOutputDirectory;
                Directory.CreateDirectory(log_dir);
                LogFilePath = Path.Combine(log_dir, FileNameHelper.FilterFileName(DateTime.Now.ToString() + ".log", '-'));

                file_writer           = File.AppendText(LogFilePath);
                file_writer.AutoFlush = true;
            }
            catch (Exception e)
            {
                Log.Error($"Can't create log file {LogFilePath} : {e.Message}");
                LogFilePath = null;
            }

#if !DEBUG
            enable_debug_output = SettingManager.LoadSetting <GlobalSetting>().EnableOutputDebugMessage;
#else
            enable_debug_output = true;
#endif

            var console_window_option = SettingManager.LoadSetting <GlobalSetting>().ShowOutputWindow;

#if DEBUG
            //Disable log window in designer mode
            if (App.Current?.MainWindow == null || System.ComponentModel.DesignerProperties.GetIsInDesignMode(App.Current?.MainWindow))
            {
                console_window_option = LogWindowShowOption.None;
                Info("Maybe in designer mode , hide console window.");
            }
#endif

            var enable_show_console_window = console_window_option == LogWindowShowOption.None ? false : (console_window_option == LogWindowShowOption.Always ? true : enable_debug_output);

            if (enable_show_console_window)
            {
                ConsoleWindow.Show();
            }

            Info($"log_file_path = {LogFilePath}");
        }
コード例 #32
0
            public void Run()
            {
                try
                {
                    if (_hangfireContext.Verbose)
                    {
                        _ = new ConsoleWindow();
                    }

                    _writer.WriteLine("Starting Hangfire server...");
                    _logger.Debug("Starting Hangfire server...");

                    var connectionString = ConnectionString();
                    if (string.IsNullOrEmpty(connectionString))
                    {
                        _logger.Error("Fatal Error: Could not find persistence config file. Hangfire server is unable to start.");
                        _writer.WriteLine("Fatal Error: Could not find persistence config file. Hangfire server is unable to start.");
                        _writer.Write("Press any key to exit...");
                        return;
                    }

                    ConfigureServerStorage(connectionString);
                    var dashboardEndpoint = _persistence.DashboardHostname + ":" + _persistence.DashboardPort;
                    var options           = new StartOptions();
                    options.Urls.Add(dashboardEndpoint);
                    WebApp.Start <Dashboard>(options);
                    _writer.WriteLine("Hangfire dashboard started...");
                    _logger.Debug("Hangfire dashboard started...");
                    // var backgroundJobServerOptions = new BackgroundJobServerOptions
                    // {
                    //     WorkerCount = Environment.ProcessorCount * 5
                    // };
                    // _ = new BackgroundJobServer(backgroundJobServerOptions);
                    _writer.WriteLine("Hangfire server started...");
                    _logger.Info("Hangfire server started...");
                }
                catch (Exception ex)
                {
                    _logger.Error($"Hangfire Server OnError, Error details:{ex.Message}");
                    _writer.WriteLine($"Hangfire Server OnError, Error details:{ex.Message}");
                }
            }
コード例 #33
0
 public CommandInGroupDisplayState(ConsoleWindow InParentWindow, ConsoleViewMobile InParentView)
     : base(InParentWindow, InParentView)
 {
 }
コード例 #34
0
ファイル: ConsoleViewPC.cs プロジェクト: royhu/CheatConsole
        public ConsoleViewPC(ConsoleWindow InParent)
        {
            ParentWindow = InParent;
            parser = new CommandParser();

            CandinateContext.RegisterStateByAttributes<CandinateStateAttribute>(typeof(CandinateStateAttribute).Assembly, this);
            CandinateContext.ChangeState("CommandCandinateState");

            CommandLogger.Load();
        }
コード例 #35
0
ファイル: Program.cs プロジェクト: tmbx/kwm-ng
        /// <summary>
        /// Enter the main mode of the KWM. Return true if the application
        /// must continue.
        /// </summary>
        private static bool EnterMainMode()
        {
            // Perform early linking.
            Wm.LocalDbBroker.Relink(Wm.LocalDb);

            // FIXME.
            #if true
            // Open a temporary console.
            ConsoleWindow foo = new ConsoleWindow();
            foo.Show();
            foo.OnConsoleClosing += delegate(Object sender, EventArgs args)
            {
                WmSm.RequestStop();
            };

            // Create an empty database.
            Wm.LocalDb.DeleteDb();
            Wm.LocalDb.OpenOrCreateDb(KwmPath.GetKwmDbPath());
            Wm.LocalDbBroker.InitDb();
            WmDeserializer ds = new WmDeserializer();
            ds.Deserialize();
            Debug.Assert(ds.Ex == null);

            #else
            // Open or create the database.
            Wm.LocalDb.OpenOrCreateDb(KwmPath.GetKwmDbPath());
            Wm.LocalDbBroker.InitDb();

            // Try to deserialize.
            WmDeserializer ds = new WmDeserializer();
            ds.Deserialize();

            // The deserialization failed.
            if (ds.Ex != null)
            {
                // If the user doesn't want to recover, bail out.
                if (!TellUserAboutDsrFailure()) return false;

                // Backup, delete and recreate a database.
                BackupDb();
                Wm.LocalDb.DeleteDb();
                Wm.LocalDb.OpenOrCreateDb(KwmPath.GetKwmDbPath());
                Wm.LocalDbBroker.InitDb();

                // Retry to deserialize.
                ds = new WmDeserializer();
                ds.Deserialize();
                if (ds.Ex != null) throw ds.Ex;

                // Set the next internal workspace ID to a high value based on
                // the date to avoid conflicts with old KFS directories.
                ds.WmCd.NextKwsInternalID = (UInt64)(DateTime.Now - new DateTime(2010, 1, 1)).TotalSeconds;
            }
            #endif

            // Relink the workspace manager object graphs.
            Wm.Relink(ds);

            // Open the lingering database transaction.
            Wm.LocalDb.BeginTransaction();

            // Serialize the WM state that has changed.
            Wm.Serialize();

            // Export the workspaces, then exit.
            if (ExportKwsPath != "")
            {
                WmKwsImportExport.ExportKws(ExportKwsPath, 0);
                return false;
            }

            // Set the handle to the message window.
            SetKwmHandle(MsgWindow.Handle);

            // Pass the hand to the WM state machine.
            WmSm.RequestStart();

            return true;
        }
コード例 #36
0
ファイル: ConsoleWindow.cs プロジェクト: HexHash/LegacyRust
 private void Awake()
 {
     ConsoleWindow.singleton = this;
 }
コード例 #37
0
ファイル: Program.cs プロジェクト: nitrocaster/xrConsole
 private static void Main()
 {
     Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(true);
     var logFileName = String.Format("xrConsole_{0}.log", Environment.UserName);
     logger = new PlainLogger(logFileName);
     consoleWnd = new ConsoleWindow();
     console = consoleWnd.Console;
     console.AttachLogger(logger);
     console.AddCommand(new Func(console, "quit", Console_Quit));
     console.AddCommand(new Func(console, "clear_log", Console_ClearLog, "Clear log"));
     console.AddCommand(new StringVar(console, "font_face",
         new Accessor<string>(Console_GetFontFace, Console_SetFontFace), 255, "Console font face"));
     console.AddCommand(new FloatVar(console, "font_size",
         new Accessor<float>(Console_GetFontSize, Console_SetFontSize), 5.0f, 20.0f, "Console font size"));
     console.Header.Add(new ConsoleLabel
         { Text = "The quick brown fox jumps over the lazy dog", Color = ConsoleColors.DarkBlue });
     console.Header.Add(new ConsoleLabel
         { Text = "Another useful label", Color = ConsoleColors.DarkMagneta });
     consoleWnd.ShowDialog();
     if (logger != null)
     {
         logger.Dispose();
     }
 }
コード例 #38
0
 public CommandDisplayBasicState(ConsoleWindow InParentWindow, ConsoleViewMobile InParentView)
 {
     ParentWindow = InParentWindow;
     ParentView = InParentView;
 }
コード例 #39
0
        public ConsoleViewMobile(ConsoleWindow InParent)
        {
            ParentWindow = InParent;

            States.RegisterStateByAttributes<CommandDisplayAttribute>(typeof(CommandDisplayAttribute).Assembly, ParentWindow, this);
            States.ChangeState("CommandGroupDisplayState");
        }