A Log output that stores all log entries in memory.
Inheritance: ILogOutput
コード例 #1
0
        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));
            }
        }
コード例 #2
0
ファイル: Log.cs プロジェクト: Andrea/duality-withsvn-history
		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);
		}
コード例 #3
0
ファイル: Log.cs プロジェクト: Scottyaim/duality
		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);
		}
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: Log.cs プロジェクト: ymoussaba/duality
        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));
        }
コード例 #6
0
ファイル: Log.cs プロジェクト: KETMGaming/duality
		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));
			}
		}
コード例 #7
0
ファイル: LogEntryList.cs プロジェクト: Terracorrupt/duality
			public ViewEntry(DataLogOutput.LogEntry log)
			{
				this.log = log;
			}
コード例 #8
0
ファイル: LogEntryList.cs プロジェクト: Terracorrupt/duality
		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);
			}
		}
コード例 #9
0
ファイル: LogEntryList.cs プロジェクト: Terracorrupt/duality
		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;
		}
コード例 #10
0
ファイル: LogEntryList.cs プロジェクト: Terracorrupt/duality
		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();
		}
コード例 #11
0
ファイル: LogEntryList.cs プロジェクト: Terracorrupt/duality
		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;
		}
コード例 #12
0
ファイル: LogEntryList.cs プロジェクト: Terracorrupt/duality
		public ViewEntry GetViewEntry(DataLogOutput.LogEntry entry)
		{
			return this.entryList.FirstOrDefault(e => e.LogEntry == entry);
		}
コード例 #13
0
		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();
			}
		}
コード例 #14
0
ファイル: LogEntryList.cs プロジェクト: Banbury/duality
			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;
			}