public void Log(LogType Type, string Message, int BalloonTime, Exception e) { // Avoid repetition if ((Engine.Instance.Storage != null) && (Engine.Instance.Storage.GetBool("log.repeat") == false)) { string logRepetitionNormalized = Message; logRepetitionNormalized = System.Text.RegularExpressions.Regex.Replace(logRepetitionNormalized, "#\\d+", "#n"); if (logRepetitionNormalized == m_logLast) { m_logLastCount++; return; } else { int oldCount = m_logLastCount; m_logLast = logRepetitionNormalized; m_logLastCount = 0; if (oldCount != 0) { Engine.Instance.Logs.Log(LogType.Verbose, MessagesFormatter.Format(Messages.LogsLineRepetitionSummary, oldCount.ToString())); } } } LogEntry l = new LogEntry(); l.Type = Type; l.Message = Message; l.BalloonTime = BalloonTime; l.Exception = e; if (l.Type > LogType.Realtime) { m_lastLogMessage = l.Message; m_logDotCount += 1; m_logDotCount = m_logDotCount % 10; } Entries.Add(l); if ((Engine.Instance != null) && (Engine.Instance.Storage != null) && (Entries.Count >= Engine.Instance.Storage.GetInt("gui.log_limit"))) { Entries.RemoveAt(0); } if (LogEvent != null) { LogEvent(l); } XmlItem xml = new XmlItem("command"); xml.SetAttribute("action", "ui.log"); l.WriteXML(xml); Engine.Instance.Command(xml); Engine.Instance.OnLog(l); }
public void UpdateValue(string key, string newValue) { StatsEntry entry = Get(key); if (entry.Value != newValue) { entry.Value = newValue; XmlItem xml = new XmlItem("command"); xml.SetAttribute("action", "ui.stats.change"); entry.WriteXML(xml); Engine.Instance.Command(xml); Engine.Instance.OnStatsChange(entry); } }
public void WriteXML(XmlItem item) { item.SetAttributeInt64("timestamp", Conversions.ToUnixTime(Date)); item.SetAttribute("level", GetTypeString()); item.SetAttribute("message", Message); }
public bool Listed = false; // Not really used public void WriteXML(XmlItem item) { item.SetAttribute("key", Key); item.SetAttribute("value", Value); item.SetAttribute("text", Text); }