Exemplo n.º 1
0
        private void timerLogSchedule_Tick(object sender, EventArgs e)
        {
            if (this.boundToLogOutput == null)
            {
                return;
            }

            int logLength = this.boundToLogOutput.EntryCount;

            if (logLength > this.lastLogItemCount)
            {
                EditorLogEntry[] newEntries = new EditorLogEntry[logLength - this.lastLogItemCount];
                this.boundToLogOutput.ReadEntries(
                    newEntries,
                    0,
                    this.lastLogItemCount,
                    logLength - this.lastLogItemCount);

                this.ProcessIncomingEntries(newEntries);
                this.lastLogItemCount          = logLength;
                this.timerLogSchedule.Interval = 50;
            }
            else
            {
                this.timerLogSchedule.Interval = 200;
            }
        }
Exemplo n.º 2
0
            public ViewEntry(LogEntryList parent, EditorLogEntry log)
            {
                this.log = log;

                int lineCount = log.Content.Message.Split(new string[] { Environment.NewLine }, StringSplitOptions.None).Length;

                this.height = Math.Max(20, 7 + lineCount * parent.Font.Height);

                if (this.log.Source == Logs.Game)
                {
                    this.sourceIcon = Properties.LogViewResCache.IconLogGame;
                }
                else if (this.log.Source == Logs.Core)
                {
                    this.sourceIcon = Properties.LogViewResCache.IconLogCore;
                }
                else if (this.log.Source == Logs.Editor)
                {
                    this.sourceIcon = Properties.LogViewResCache.IconLogEditor;
                }
                else if (this.log.Source.CustomInfo != null)
                {
                    this.sourceIcon = this.log.Source.CustomInfo.GetType().GetEditorImage();
                }
            }
 private void SubscribeToLogs(Lifetime lifetime, EditorPluginModel editor)
 {
     editor.Log.Advise(lifetime, entry =>
     {
         myLogger.Verbose(entry.Time + " " + entry.Mode + " " + entry.Type + " " + entry.Message + " " + Environment.NewLine + " " + entry.StackTrace);
         var logEntry = new EditorLogEntry((int)entry.Type, (int)entry.Mode, entry.Time, entry.Message, entry.StackTrace);
         myHost.PerformModelAction(m => m.OnUnityLogEvent(logEntry));
     });
 }
Exemplo n.º 4
0
        private void logEntryList_LogEntriesAdded(object sender, LogEntryList.ViewEntryEventArgs e)
        {
            bool isHidden      = this.DockHandler.DockState.IsAutoHide() && !this.ContainsFocus;
            bool unseenChanges = false;

            bool containsError = false;

            for (int i = 0; i < e.ViewEntries.Count; i++)
            {
                EditorLogEntry logEntry = e.ViewEntries[i].LogEntry;
                LogMessageType type     = logEntry.Content.Type;

                if (isHidden)
                {
                    if (type == LogMessageType.Warning)
                    {
                        this.unseenWarnings++;
                        unseenChanges = true;
                    }
                    else if (type == LogMessageType.Error)
                    {
                        if (this.unseenErrors == 0)
                        {
                            System.Media.SystemSounds.Hand.Play();
                        }
                        this.unseenErrors++;
                        unseenChanges = true;
                    }
                }
                if (type == LogMessageType.Error)
                {
                    containsError = true;
                }

                this.AddSourceFilterButton(logEntry.Source);
            }

            if (unseenChanges)
            {
                this.UpdateTabText();
            }

            bool pause =
                containsError &&
                this.buttonPauseOnError.Checked &&
                Sandbox.State == SandboxState.Playing &&
                !Sandbox.IsChangingState;

            if (pause)
            {
                System.Media.SystemSounds.Hand.Play();
                Sandbox.Pause();
            }
        }
Exemplo n.º 5
0
        private void UpdateDisplayedEntries()
        {
            this.displayedEntryList.Clear();
            for (int i = 0; i < this.entryList.Count; i++)
            {
                EditorLogEntry logEntry = this.entryList[i].LogEntry;

                if (this.msgTypeFilter.Contains(logEntry.Content.Type))
                {
                    continue;
                }
                if (this.sourceIdFilter.Contains(logEntry.Source.Id))
                {
                    continue;
                }

                this.displayedEntryList.Add(this.entryList[i]);
            }
        }