Esempio n. 1
0
        public void OnConsoleEntryAdded(AbstractConsole console, ref ConsoleViewCellEntry entry)
        {
            CycleArray <ConsoleViewCellEntry> Entries = this.Entries;

            // if unfiltered console entries overflow - we need to adjust indices and visible lines
            if (m_oldConsoleEntriesHeadIndex < Entries.HeadIndex)
            {
                m_oldConsoleEntriesHeadIndex = Entries.HeadIndex;

                int indicesHeadIndex = m_filteredIndices.HeadIndex;
                while (indicesHeadIndex < m_filteredIndices.Length && m_filteredIndices[indicesHeadIndex] < Entries.HeadIndex)
                {
                    ++indicesHeadIndex;
                }

                m_filteredIndices.TrimToHeadIndex(indicesHeadIndex);
                m_consoleView.TrimCellsToHead(indicesHeadIndex);
            }

            int entryIndex      = Entries.Length - 1;
            int entryArrayIndex = Entries.ToArrayIndex(entryIndex);

            if (Apply(ref Entries.InternalArray[entryArrayIndex]))
            {
                m_filteredIndices.Add(entryIndex);
                m_consoleView.OnConsoleEntryAdded(console, ref entry);
            }
        }
Esempio n. 2
0
 public virtual void Add(LogLevel level, Tag tag, string[] table, string stackTrace)
 {
     ConsoleViewCellEntry entry = new ConsoleViewCellEntry(table);
     entry.level = level;
     entry.tag = tag;
     entry.stackTrace = stackTrace;
     Add(entry);
 }
Esempio n. 3
0
        public virtual void Add(LogLevel level, Tag tag, string[] table, string stackTrace)
        {
            ConsoleViewCellEntry entry = new ConsoleViewCellEntry(table);

            entry.level      = level;
            entry.tag        = tag;
            entry.stackTrace = stackTrace;
            Add(entry);
        }
        private float HeightForTableCell(ref ConsoleViewCellEntry entry)
        {
            if (entry.width != this.ContentWidth)
            {
                entry.Layout(m_textMeasure, this.Width - UISize.ScrollBarWidth, this.ContentWidth);
            }

            return(entry.height);
        }
 public void OnConsoleEntryAdded(AbstractConsole console, ref ConsoleViewCellEntry entry)
 {
     if (entry.IsTable)
     {
         string[] table = entry.Table;
         foreach (string item in table)
         {
             terminalTableOutput.Add(StringUtils.RemoveRichTextTags(item));
         }
     }
 }
        public void TestFlowLayoutSinglelWordEqualToMaxWidth()
        {
            Vector2 size = new Vector2(5, 1);

            string line = "12345";
            ConsoleViewCellEntry entry = new ConsoleViewCellEntry(line);
            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                "12345"
            );
        }
Esempio n. 7
0
        public bool Apply(ref ConsoleViewCellEntry entry)
        {
            for (int i = 0; i < m_filters.Count; ++i)
            {
                if (!m_filters[i].Apply(ref entry))
                {
                    return false;
                }
            }

            return true;
        }
Esempio n. 8
0
        public bool Apply(ref ConsoleViewCellEntry entry)
        {
            for (int i = 0; i < m_filters.Count; ++i)
            {
                if (!m_filters[i].Apply(ref entry))
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 9
0
 internal void Add(ConsoleViewCellEntry entry)
 {
     if (ThreadUtils.IsUnityThread())
     {
         Entries.Add(entry);
         Delegate.OnConsoleEntryAdded(this, ref entry);
     }
     else
     {
         TimerManager.ScheduleTimer(() =>
         {
             Add(entry);
         });
     }
 }
 internal void Add(ConsoleViewCellEntry entry)
 {
     if (ThreadUtils.IsUnityThread())
     {
         Entries.Add(entry);
         Delegate.OnConsoleEntryAdded(this, ref entry);
     }
     else
     {
         TimerManager.ScheduleTimer(() =>
         {
             Add(entry);
         });
     }
 }
Esempio n. 11
0
        //////////////////////////////////////////////////////////////////////////////

        private TableViewCell CreateTableCell(TableView table, ref ConsoleViewCellEntry entry)
        {
            if (entry.IsPlain || entry.IsTable)
            {
                ConsoleTextEntryView cell;

                if (entry.level == LogLevel.Exception)
                {
                    ConsoleTextEntryExceptionView exceptionCell = table.DequeueReusableCell <ConsoleTextEntryExceptionView>();
                    if (exceptionCell == null)
                    {
                        exceptionCell = new ConsoleTextEntryExceptionView();
                    }
                    exceptionCell.StackTraceLines = entry.data as StackTraceLine[];

                    cell = exceptionCell;
                }
                else
                {
                    cell = table.DequeueReusableCell <ConsoleTextEntryView>();
                    if (cell == null)
                    {
                        cell = new ConsoleTextEntryView();
                    }
                }

                // set the size first to calculate individual lines height
                ColorCode colorCode = entry.level != null ? entry.level.Color : ColorCode.Plain;
                cell.TextColor = EditorSkin.GetColor(colorCode);
                cell.Width     = entry.width;
                cell.Height    = entry.height;

                cell.Value      = entry.value;
                cell.LogLevel   = entry.level;
                cell.StackTrace = entry.stackTrace;

                return(cell);
            }
            else
            {
                throw new NotImplementedException("Unexpected entry type");
            }
        }
Esempio n. 12
0
 public abstract bool Apply(ref ConsoleViewCellEntry entry);
        //////////////////////////////////////////////////////////////////////////////

        #region IConsoleDelegate null implementation

        public void OnConsoleEntryAdded(AbstractConsole console, ref ConsoleViewCellEntry entry)
        {
        }
        public void TestTableLayoutSevenItemsTwoRows()
        {
            Vector2 size = new Vector2(18, 3);

            List<string> lines = new List<string>();
            lines.Add("1111");
            lines.Add("2222");
            lines.Add("3333");
            lines.Add("4444");
            lines.Add("5555");
            lines.Add("6666");
            lines.Add("7777");

            ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines.ToArray());
            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                "1111" + kSpace + "4444" + kSpace + "7777" + "\n" +
                "2222" + kSpace + "5555" + "\n" +
                "3333" + kSpace + "6666"
            );
        }
Esempio n. 15
0
 public override bool Apply(ref ConsoleViewCellEntry entry)
 {
     return entry.level != null && entry.level.Priority >= m_level.Priority;
 }
Esempio n. 16
0
 public override bool Apply(ref ConsoleViewCellEntry entry)
 {
     return CultureInfo.CurrentCulture.CompareInfo.IndexOf(entry.value, m_text, CompareOptions.IgnoreCase) != -1;
 }
 public void OnConsoleEntryAdded(AbstractConsole console, ref ConsoleViewCellEntry entry)
 {
 }
Esempio n. 18
0
 public abstract bool Apply(ref ConsoleViewCellEntry entry);
Esempio n. 19
0
        //////////////////////////////////////////////////////////////////////////////

        #region IConsoleDelegate implementation

        public void OnConsoleEntryAdded(AbstractConsole console, ref ConsoleViewCellEntry entry)
        {
            ReloadNewData();
            Repaint();
        }
Esempio n. 20
0
        //////////////////////////////////////////////////////////////////////////////
        private TableViewCell CreateTableCell(TableView table, ref ConsoleViewCellEntry entry)
        {
            if (entry.IsPlain || entry.IsTable)
            {
                ConsoleTextEntryView cell;

                if (entry.level == LogLevel.Exception)
                {
                    ConsoleTextEntryExceptionView exceptionCell = table.DequeueReusableCell<ConsoleTextEntryExceptionView>();
                    if (exceptionCell == null)
                    {
                        exceptionCell = new ConsoleTextEntryExceptionView();
                    }
                    exceptionCell.StackTraceLines = entry.data as StackTraceLine[];

                    cell = exceptionCell;
                }
                else
                {
                    cell = table.DequeueReusableCell<ConsoleTextEntryView>();
                    if (cell == null)
                    {
                        cell = new ConsoleTextEntryView();
                    }
                }

                // set the size first to calculate individual lines height
                ColorCode colorCode = entry.level != null ? entry.level.Color : ColorCode.Plain;
                cell.TextColor = EditorSkin.GetColor(colorCode);
                cell.Width = entry.width;
                cell.Height = entry.height;

                cell.Value = entry.value;
                cell.LogLevel = entry.level;
                cell.StackTrace = entry.stackTrace;

                return cell;
            }
            else
            {
                throw new NotImplementedException("Unexpected entry type");
            }
        }
 public override bool Apply(ref ConsoleViewCellEntry entry)
 {
     return m_delegate(ref entry);
 }
Esempio n. 22
0
        public void OnConsoleEntryAdded(AbstractConsole console, ref ConsoleViewCellEntry entry)
        {
            CycleArray<ConsoleViewCellEntry> Entries = this.Entries;

            // if unfiltered console entries overflow - we need to adjust indices and visible lines
            if (m_oldConsoleEntriesHeadIndex < Entries.HeadIndex)
            {
                m_oldConsoleEntriesHeadIndex = Entries.HeadIndex;

                int indicesHeadIndex = m_filteredIndices.HeadIndex;
                while(indicesHeadIndex < m_filteredIndices.Length && m_filteredIndices[indicesHeadIndex] < Entries.HeadIndex)
                {
                    ++indicesHeadIndex;
                }

                m_filteredIndices.TrimToHeadIndex(indicesHeadIndex);
                m_consoleView.TrimCellsToHead(indicesHeadIndex);
            }

            int entryIndex = Entries.Length - 1;
            int entryArrayIndex = Entries.ToArrayIndex(entryIndex);
            if (Apply(ref Entries.InternalArray[entryArrayIndex]))
            {
                m_filteredIndices.Add(entryIndex);
                m_consoleView.OnConsoleEntryAdded(console, ref entry);
            }
        }
        public void TestTableLayoutSingleLongItemExactFit()
        {
            Vector2 size = new Vector2(4, 1);

            List<string> lines = new List<string>();
            lines.Add("1111");

            ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines.ToArray());
            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                "1111"
            );
        }
Esempio n. 24
0
 public override bool Apply(ref ConsoleViewCellEntry entry)
 {
     return entry.tag != null && m_tags.Contains(entry.tag);
 }
        public void TestTableLayoutTwoItemsSingleRow()
        {
            Vector2 size = new Vector2(14, 1);

            string[] lines = { "111", "2222" };

            ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines);
            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                "111 " + kSpace + "2222"
            );
        }
        public void TestTableLayoutFourItemsTwoRows()
        {
            Vector2 size = new Vector2(14, 2);

            string[] lines = { "1111", "2222", "3333", "4444" };

            ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines);
            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                "1111" + kSpace + "3333" + "\n" +
                "2222" + kSpace + "4444"
            );
        }
Esempio n. 27
0
 public void OnConsoleEntryAdded(AbstractConsole console, ref ConsoleViewCellEntry entry)
 {
     ReloadNewData();
     Repaint();
 }
        public void TestTableLayoutSingleItem()
        {
            Vector2 size = new Vector2(14, 1);

            string[] lines = { "1111" };

            ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines);
            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                "1111"
            );
        }
Esempio n. 29
0
        private float HeightForTableCell(ref ConsoleViewCellEntry entry)
        {
            if (entry.width != this.ContentWidth)
            {
                entry.Layout(m_textMeasure, this.Width - UISize.ScrollBarWidth, this.ContentWidth);
            }

            return entry.height;
        }
        public void TestTableLayoutTwoItemsDifferentSizeTwoRows()
        {
            Vector2 size = new Vector2(18, 2);

            List<string> lines = new List<string>();
            lines.Add("1111");
            lines.Add("222222");
            lines.Add("33333");

            ConsoleViewCellEntry entry = new ConsoleViewCellEntry(lines.ToArray());
            entry.Layout(this, size.x);

            AssertCellEntryLayout(entry, size,
                "1111  " + kSpace + "33333" + "\n" +
                "222222"
            );
        }
Esempio n. 31
0
 public override bool Apply(ref ConsoleViewCellEntry entry)
 {
     return(CultureInfo.CurrentCulture.CompareInfo.IndexOf(entry.value, m_text, CompareOptions.IgnoreCase) != -1);
 }
 private void AssertCellEntryLayout(ConsoleViewCellEntry entry, Vector2 expectedSize, string expectedValue)
 {
     Assert.AreEqual(expectedValue, entry.value);
     Assert.AreEqual(expectedSize.x, entry.width);
     Assert.AreEqual(expectedSize.y, entry.height);
 }
Esempio n. 33
0
 public override bool Apply(ref ConsoleViewCellEntry entry)
 {
     return(entry.tag != null && m_tags.Contains(entry.tag));
 }
 public void Add(LogLevel level, Tag tag, string line)
 {
     ConsoleViewCellEntry entry = new ConsoleViewCellEntry(line);
     entry.level = level;
     entry.tag = tag;
     Add(entry);
 }
Esempio n. 35
0
 public override bool Apply(ref ConsoleViewCellEntry entry)
 {
     return(entry.level != null && entry.level.Priority >= m_level.Priority);
 }