static Log() { SharedState state = new SharedState(); data = new DataLogOutput(); logGame = new Log("Game", state, data); logCore = new Log("Core", state, data); logEditor = new Log("Edit", state, data); bool hasConsole = true; try { int doesThisThrow = Console.WindowHeight; } catch (Exception) { hasConsole = false; } if (System.Diagnostics.Debugger.IsAttached || hasConsole) { logGame.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkGray)); logCore.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkBlue)); logEditor.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkMagenta)); } }
static Log() { SharedState state = new SharedState(); data = new DataLogOutput(); logGame = new Log("Game", state, new ConsoleLogOutput(ConsoleColor.DarkGray), data); logCore = new Log("Core", state, new ConsoleLogOutput(ConsoleColor.DarkBlue), data); logEditor = new Log("Edit", state, new ConsoleLogOutput(ConsoleColor.DarkMagenta), data); }
static Log() { SharedState state = new SharedState(); data = new DataLogOutput(); logGame = new Log("Game", state, data); logCore = new Log("Core", state, data); logEditor = new Log("Edit", state, data); }
static Log() { SharedState state = new SharedState(); data = new DataLogOutput(); logGame = new Log("Game", state, data); logCore = new Log("Core", state, data); logEditor = new Log("Edit", state, data); logGame.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkGray)); logCore.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkBlue)); logEditor.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkMagenta)); }
public ViewEntry(DataLogOutput.LogEntry log) { this.log = log; }
private void boundOutput_NewEntry(object sender, DataLogOutput.LogEntryEventArgs e) { lock (this.logSchedule) { this.logSchedule.Add(e.Entry); } if (!this.timerLogSchedule.Enabled) { // Don't use a synchronous Invoke. It will block while the BuildManager is active (why?) // and thus lead to a deadlock when something is logged while it is. this.InvokeEx(() => this.timerLogSchedule.Enabled = true, false); } }
public void BindToOutput(DataLogOutput dualityLog) { if (this.boundOutput == dualityLog) return; if (this.boundOutput != null) this.boundOutput.NewEntry -= this.boundOutput_NewEntry; this.boundOutput = dualityLog; this.UpdateFromLog(this.boundOutput); if (this.boundOutput != null) this.boundOutput.NewEntry += this.boundOutput_NewEntry; }
public void UpdateFromLog(DataLogOutput dualityLog) { if (dualityLog == null) { this.Clear(); return; } this.entryList.Clear(); foreach (var entry in dualityLog.Data) this.entryList.Add(new ViewEntry(entry)); this.OnContentChanged(); }
public ViewEntry AddEntry(DataLogOutput.LogEntry entry) { ViewEntry viewEntry = new ViewEntry(entry); this.entryList.Add(viewEntry); if (this.NewEntry != null) this.NewEntry(this, new ViewEntryEventArgs(viewEntry)); this.OnContentChanged(); return viewEntry; }
public ViewEntry GetViewEntry(DataLogOutput.LogEntry entry) { return this.entryList.FirstOrDefault(e => e.LogEntry == entry); }
private void LogData_NewEntry(object sender, DataLogOutput.LogEntryEventArgs e) { if (this.InvokeRequired) return; bool pause = e.Entry.Type == LogMessageType.Error && this.buttonPauseOnError.Checked && Sandbox.State == SandboxState.Playing && !Sandbox.IsChangingState; if (pause) { System.Media.SystemSounds.Hand.Play(); Sandbox.Pause(); } }
public ViewEntry(LogEntryList parent, DataLogOutput.LogEntry log) { this.parent = parent; this.log = log; this.msgLines = log.Message.Split(new string[] { Environment.NewLine }, StringSplitOptions.None).Length; }