Пример #1
0
 public static void InitializeForConsole(RichTextBox richTextBox)
 {
     RichTextBoxHelpers.PARAFORMAT2 lParam = new RichTextBoxHelpers.PARAFORMAT2();
     lParam.cbSize        = Marshal.SizeOf((object)lParam);
     lParam.dwMask       |= 192U;
     lParam.dySpaceBefore = 28;
     lParam.dySpaceAfter  = 28;
     RichTextBoxHelpers.SendMessage(richTextBox.Handle, 1095, 0, ref lParam);
 }
Пример #2
0
        public Console()
        {
            this._profiles = new Kerberos.Sots.Console.Console.ConsoleProfile[5]
            {
                new Kerberos.Sots.Console.Console.ConsoleProfile()
                {
                    Name       = "AI Debugging",
                    Categories = new List <string>()
                    {
                        "ai",
                        "con",
                        "log"
                    },
                    LogLevel = Kerberos.Sots.Engine.LogLevel.Normal
                },
                new Kerberos.Sots.Console.Console.ConsoleProfile()
                {
                    Name       = "Ship Design Debugging",
                    Categories = new List <string>()
                    {
                        "ai",
                        "design",
                        "con",
                        "log"
                    },
                    LogLevel = Kerberos.Sots.Engine.LogLevel.Verbose
                },
                new Kerberos.Sots.Console.Console.ConsoleProfile()
                {
                    Name       = "Asset Debugging",
                    Categories = new List <string>()
                    {
                        "asset",
                        "con",
                        "log"
                    },
                    LogLevel = Kerberos.Sots.Engine.LogLevel.Verbose
                },
                new Kerberos.Sots.Console.Console.ConsoleProfile()
                {
                    Name       = "Combat Debugging",
                    Categories = new List <string>()
                    {
                        "combat",
                        "con",
                        "log"
                    },
                    LogLevel = Kerberos.Sots.Engine.LogLevel.Verbose
                },
                new Kerberos.Sots.Console.Console.ConsoleProfile()
                {
                    Name       = "Game Flow Debugging",
                    Categories = new List <string>()
                    {
                        "con",
                        "state",
                        "game",
                        "log"
                    },
                    LogLevel = Kerberos.Sots.Engine.LogLevel.Normal
                }
            };
            this._textAdded     = new StringBuilder();
            this._textRuns      = new List <Kerberos.Sots.Console.Console.TextRun>();
            this._categoryInfos = new Dictionary <string, Kerberos.Sots.Console.Console.CategoryInfo>();
            this._logLevelItems = new Dictionary <Kerberos.Sots.Engine.LogLevel, ToolStripMenuItem>();
            this.MaxSize        = 10000000;
            this.InitializeComponent();
            this._postTextTimer          = new Timer();
            this._postTextTimer.Interval = 500;
            this._postTextTimer.Tick    += new EventHandler(this.PostTextTimerTick);
            this._postTextTimer.Start();
            RichTextBoxHelpers.InitializeForConsole(this.richTextBox1);
            this.richTextBox1.SelectionHangingIndent = 72;
            int num = 1;

            foreach (Kerberos.Sots.Engine.LogLevel index in (Kerberos.Sots.Engine.LogLevel[])Enum.GetValues(typeof(Kerberos.Sots.Engine.LogLevel)))
            {
                this._logLevelItems[index] = new ToolStripMenuItem(string.Format("(&{0}) {1}", (object)num, (object)index), (Image)null, new EventHandler(this.OnMenuClick));
                ++num;
            }
            this.verbosityToolStripMenuItem.DropDownItems.AddRange((ToolStripItem[])this._logLevelItems.Values.ToArray <ToolStripMenuItem>());
            this.SynchronizeWithLogLevel();
            foreach (Kerberos.Sots.Console.Console.ConsoleProfile profile in this._profiles)
            {
                profile.MenuItem = new ToolStripMenuItem(profile.Name, (Image)null, new EventHandler(this.OnMenuClick));
                this.profilesToolStripMenuItem.DropDownItems.Add((ToolStripItem)profile.MenuItem);
            }
            this.logPathTextBox.Text = App.Log.FilePath;
            foreach (FieldInfo field in typeof(LogCategories).GetFields())
            {
                this.RegisterCategory(field.GetRawConstantValue() as string);
            }
            this.ApplyProfile(this._profiles[0]);
        }