Beispiel #1
0
 protected void  OnRowAdded(StreamLog stream, Row row, int consoleIndex)
 {
     if (this.RowAdded != null)
     {
         this.RowAdded(stream, row, consoleIndex);
     }
 }
Beispiel #2
0
        private void    CreateStreamForCategory(int consoleIndex, Row row)
        {
            // StreamLog does not receive output from compiler.
            if ((row.log.mode & (Mode.ScriptCompileError | Mode.ScriptCompileWarning)) != 0)
            {
                return;
            }

            // Category has a priority over all rules.
            string category;
            int    hash = row.log.condition.GetHashCode();

            if (MainModule.methodsCategories.TryGetValue(hash, out category) == false)
            {
                ILogContentGetter log = row as ILogContentGetter;

                if (log != null)
                {
                    category = log.Category;
                }
                else
                {
                    category = null;
                }

                MainModule.methodsCategories.Add(hash, category);
            }

            if (category != null)
            {
                for (int j = 0; j < this.streams.Count; j++)
                {
                    if (this.streams[j].onlyCategory == true && this.streams[j].name == category)
                    {
                        return;
                    }
                }

                MainModuleSettings mainSettings = HQ.Settings.Get <MainModuleSettings>();
                StreamLog          stream       = new StreamLog();
                stream.onlyCategory = true;
                stream.name         = category;
                stream.Init(this.console, this);

                foreach (ILogFilter filter in mainSettings.GenerateFilters())
                {
                    stream.groupFilters.filters.Add(filter);
                }

                this.streams.Add(stream);

                if (this.StreamAdded != null)
                {
                    this.StreamAdded(stream);
                }
            }
        }
Beispiel #3
0
        public void     DeleteStream(int i)
        {
            StreamLog stream = this.streams[i];

            stream.Uninit();
            this.streams.RemoveAt(i);

            if (this.StreamDeleted != null)
            {
                this.StreamDeleted(stream);
            }

            foreach (Vars var in this.perWindowVars.Each())
            {
                var.workingStream = Mathf.Clamp(var.workingStream, 0, this.streams.Count - 1);
            }
        }
Beispiel #4
0
        private Action <RowsDrawer.Vars> ClosureVars(StreamLog stream)
        {
            return((vars) =>
            {
                ScrollbarInterests interests;

                if (this.rowsDrawerInterests.TryGetValue(stream.rowsDrawer, out interests) == false)
                {
                    interests = new ScrollbarInterests();

                    this.rowsDrawerInterests.Add(stream.rowsDrawer, interests);
                }

                vars.scrollbar.AddListInterests(interests.filterInterests);
                vars.scrollbar.AddListInterests(interests.logTypeInterests);
                vars.scrollbar.AddListInterests(interests.warningLogsInterests);
                vars.scrollbar.AddListInterests(interests.errorLogsInterests);
            });
        }
Beispiel #5
0
        public void     DeleteStream(int i)
        {
            StreamLog stream = this.streams[i];

            stream.Uninit();
            stream.FilterAltered -= this.console.SaveModules;
            stream.OptionAltered -= this.console.SaveModules;
            this.streams.RemoveAt(i);

            if (this.StreamDeleted != null)
            {
                this.StreamDeleted(stream);
            }

            foreach (Vars var in this.perWindowVars.Each())
            {
                var.workingStream = Mathf.Clamp(var.workingStream, 0, this.streams.Count - 1);
            }

            this.console.SaveModules();
        }
Beispiel #6
0
        private Rect    DrawStreamTabs(Rect r)
        {
            float maxWidth = r.width;

            r.y     += 2F;
            r.height = Constants.SingleLineHeight;

            MainModuleSettings mainSettings = HQ.Settings.Get <MainModuleSettings>();
            ConsoleSettings    settings     = HQ.Settings.Get <ConsoleSettings>();
            Vars vars = this.perWindowVars.Get(RowUtility.drawingWindow);

            // Switch stream
            if (settings.inputsManager.Check("Navigation", ConsoleConstants.SwitchNextStreamCommand) == true)
            {
                vars.workingStream += 1;
                if (vars.workingStream >= this.streams.Count)
                {
                    vars.workingStream = 0;
                }

                Event.current.Use();
            }
            else if (settings.inputsManager.Check("Navigation", ConsoleConstants.SwitchPreviousStreamCommand) == true)
            {
                vars.workingStream -= 1;
                // Handle CompilerStream.
                if (vars.workingStream == 0 && this.compilerStream.totalCount == 0)
                {
                    vars.workingStream = this.streams.Count - 1;
                }
                if (vars.workingStream < 0)
                {
                    vars.workingStream = this.streams.Count - 1;
                }

                Event.current.Use();
            }

            for (int i = 0; i < this.streams.Count; i++)
            {
                r = this.streams[i].OnTabGUI(r, i);
            }

            r.width = 16F;

            if (GUI.Button(r, "+", HQ.Settings.Get <GeneralSettings>().MenuButtonStyle) == true)
            {
                if (this.CheckMaxStreams(this.streams.Count - 2) == true)
                {
                    StreamLog stream = new StreamLog();
                    stream.Init(this.console, this);
                    stream.FilterAltered += this.console.SaveModules;
                    stream.OptionAltered += this.console.SaveModules;

                    foreach (ILogFilter filter in mainSettings.GenerateFilters())
                    {
                        stream.groupFilters.filters.Add(filter);
                    }

                    this.streams.Add(stream);

                    this.console.SaveModules();

                    if (this.streams.Count == 1)
                    {
                        vars.workingStream = 0;
                    }

                    if (this.StreamAdded != null)
                    {
                        this.StreamAdded(stream);
                    }

                    stream.RefreshFilteredRows();
                }
            }

            r.x    += r.width;
            r.width = maxWidth - r.x;

            return(r);
        }
Beispiel #7
0
        private void    OnRowAdded(StreamLog stream, Row row, int consoleIndex)
        {
            ColorMarkersModuleSettings settings = HQ.Settings.Get <ColorMarkersModuleSettings>();
            ScrollbarInterests         interests;

            if (this.rowsDrawerInterests.TryGetValue(stream.rowsDrawer, out interests) == false)
            {
                interests = new ScrollbarInterests();

                foreach (var vars in stream.rowsDrawer.perWindowVars.Each())
                {
                    vars.scrollbar.AddListInterests(interests.filterInterests);
                    vars.scrollbar.AddListInterests(interests.logTypeInterests);
                    vars.scrollbar.AddListInterests(interests.warningLogsInterests);
                    vars.scrollbar.AddListInterests(interests.errorLogsInterests);
                }

                this.rowsDrawerInterests.Add(stream.rowsDrawer, interests);
            }

            if (settings.dotInScrollbarRowByLogType == true)
            {
                if ((row.log.mode & Mode.ScriptingException) != 0)
                {
                    interests.errorLogsInterests.Add(8F + stream.rowsDrawer.GetOffsetAtIndex(consoleIndex), HQ.Settings.Get <GeneralSettings>().differentiateException == false ? ConsoleConstants.ErrorFoldoutColor : ConsoleConstants.ExceptionFoldoutColor, consoleIndex);
                }
                else if ((row.log.mode & (Mode.ScriptCompileError | Mode.ScriptingError | Mode.Fatal | Mode.Error | Mode.Assert | Mode.AssetImportError | Mode.ScriptingAssertion)) != 0)
                {
                    interests.errorLogsInterests.Add(8F + stream.rowsDrawer.GetOffsetAtIndex(consoleIndex), ConsoleConstants.ErrorFoldoutColor, consoleIndex);
                }
                else if ((row.log.mode & (Mode.ScriptCompileWarning | Mode.ScriptingWarning | Mode.AssetImportWarning)) != 0)
                {
                    interests.warningLogsInterests.Add(8F + stream.rowsDrawer.GetOffsetAtIndex(consoleIndex), ConsoleConstants.WarningFoldoutColor, consoleIndex);
                }
                else
                {
                    goto skip;
                }
            }

skip:

            List <ColorBackground> stamps = settings.colorBackgrounds;

            for (int j = 0; j < this.coloredRows.Count; j++)
            {
                if (this.coloredRows[j].row == row)
                {
                    if (this.coloredRows[j].i < stamps.Count)
                    {
                        interests.filterInterests.Add(8F + stream.rowsDrawer.GetOffsetAtIndex(consoleIndex), stamps[this.coloredRows[j].i].color, consoleIndex);
                        return;
                    }
                }
            }

            List <ColorMarker> markers = settings.colorMarkers;

            for (int j = 0; j < markers.Count; j++)
            {
                if (markers[j].groupFilters.filters.Count > 0 &&
                    markers[j].groupFilters.Filter(row) == true)
                {
                    interests.filterInterests.Add(8F + stream.rowsDrawer.GetOffsetAtIndex(consoleIndex), markers[j].backgroundColor, consoleIndex);
                    return;
                }
            }

            IRowDotColored dotColored = row as IRowDotColored;

            if (dotColored != null)
            {
                interests.logTypeInterests.Add(8F + stream.rowsDrawer.GetOffsetAtIndex(consoleIndex), dotColored.GetColor(), consoleIndex);
            }
        }
Beispiel #8
0
 private void    OnMainStreamDeleted(StreamLog stream)
 {
     stream.RowAdded -= this.OnRowAdded;
     // It is added as a closure, removing
     //stream.rowsDrawer.perWindowVars.VarsAdded -= this.OnVarsAdded;
 }
Beispiel #9
0
 private void    OnMainStreamAdded(StreamLog stream)
 {
     stream.RowAdded += this.OnRowAdded;
     stream.rowsDrawer.perWindowVars.VarsAdded += this.ClosureVars(stream);
 }