/// <summary> /// Common log entry /// </summary> /// <param name="msg">Message to log</param> public static void Common(string msg) { LogEntry entry = new LogEntry(Level.INFO, $"{msg}", Brushes.Black); _log.Add(entry); OnNewEntry?.Invoke(new LogEventArgs(entry)); }
void ActionEntry(JournalEntry je) // issue the JE to the system { if (je.IsUIEvent) // give windows time to set up for OnNewEvent, and tell them if its coming via showuievents { if (je is EliteDangerousCore.JournalEvents.JournalMusic) { //System.Diagnostics.Debug.WriteLine("Dispatch from controller Journal UI event "); OnNewUIEvent?.Invoke(new EliteDangerousCore.UIEvents.UIJournalMusic((je as EliteDangerousCore.JournalEvents.JournalMusic).MusicTrack, EDDConfig.Instance.ShowUIEvents, DateTime.UtcNow, false)); } } OnNewJournalEntry?.Invoke(je); // Always call this on all entries... // filter out commanders, and filter out any UI events if (je.CommanderId == history.CommanderId && (!je.IsUIEvent || EDDConfig.Instance.ShowUIEvents)) { HistoryEntry he = history.AddJournalEntry(je, h => LogLineHighlight(h)); // add a new one on top //System.Diagnostics.Debug.WriteLine("Add HE " + he.EventSummary); OnNewEntry?.Invoke(he, history); // major hook OnNewEntrySecond?.Invoke(he, history); // secondary hook.. } if (je.EventTypeID == JournalTypeEnum.LoadGame) // and issue this on Load game { OnRefreshCommanders?.Invoke(); } }
public void NewEntry(JournalEntry je) // hooked into journal monitor and receives new entries.. Also call if you programatically add an entry { if (je.CommanderId == history.CommanderId) // we are only interested at this point accepting ones for the display commander { bool uievent = je.IsUIEvent; if (!je.IsUIEvent || EDDConfig.Instance.ShowUIEvents) // filter out any UI events { foreach (HistoryEntry he in history.AddJournalEntry(je, h => LogLineHighlight(h))) { OnNewEntry?.Invoke(he, history); // major hook OnNewEntrySecond?.Invoke(he, history); // secondary hook.. } } else { System.Diagnostics.Debug.WriteLine("**** Filter out " + je.EventTypeStr); } if (uievent) { if (je is EliteDangerousCore.JournalEvents.JournalMusic) { OnNewUIEvent?.Invoke((je as EliteDangerousCore.JournalEvents.JournalMusic).MusicTrack); } } } OnNewJournalEntry?.Invoke(je); if (je.EventTypeID == JournalTypeEnum.LoadGame) { OnRefreshCommanders?.Invoke(); } }
/// <summary> /// Debug log entry /// </summary> /// <param name="msg">Message to log</param> public static void Debug(string msg) { LogEntry entry = new LogEntry(Level.DEBUG, $"{msg}", Brushes.DarkCyan); _log.Add(entry); OnNewEntry?.Invoke(new LogEventArgs(entry)); }
/// <summary> /// Error /// </summary> /// <param name="msg">Message to log</param> public static void Error(string msg) { LogEntry entry = new LogEntry(Level.ERROR, $"{msg}", Brushes.Red); _log.Add(entry); OnNewEntry?.Invoke(new LogEventArgs(entry)); }
/// <summary> /// Warning /// </summary> /// <param name="msg">Message to log</param> public static void Warn(string msg) { LogEntry entry = new LogEntry(Level.WARN, $"{msg}", Brushes.DarkOrange); _log.Add(entry); OnNewEntry?.Invoke(new LogEventArgs(entry)); }
private void ParseStart() { var structure = GetStructure(); var inps = zip.Entries.Where(entry => entry.Name.EndsWith(".inp")); foreach (var inp in inps) { using (var stream = inp.Open()) { var sr = new StreamReader(stream, Encoding.UTF8); while (!sr.EndOfStream) { var line = sr.ReadLine().Split('\x04'); var names = GetDelimArray(':', line[structure.Author]); var authors = new List <Author>(); foreach (var name in names) { var author = GetDelimArray(',', name, false); authors.Add(new Author { FirstName = SanitizeName(author.Length >= 2 ? author[1] : null), MiddleName = SanitizeName(author.Length >= 3 ? author[2] : null), LastName = SanitizeName(author[0]), }); } var args = new Book { Id = Guid.Empty, Authors = authors.ToArray(), Genres = GetDelimArray(':', line[structure.Genre]), Title = line[structure.Title], Series = SanitizeName(line[structure.Series]), SeriesNo = ParseInt(line[structure.SeriesNo]), File = line[structure.File], Size = int.Parse(line[structure.Size]), LibId = int.Parse(line[structure.LibId]), Del = line[structure.Del] == "1", Ext = line[structure.Ext], Date = DateTime.Parse(line[structure.Date]), Language = structure.Language != -1 ? line[structure.Language] : null, Keywords = structure.Keywords != -1 ? GetDelimArray(':', line[structure.Keywords]) : null, Archive = inp.Name.Replace(".inp", ".zip"), }; OnNewEntry?.Invoke(this, new NewEntryEventArgs { Book = args }); } } } OnFinished?.Invoke(this); }
private void ActionEntry(JournalEntry je) // UI thread issue the JE to the system { OnNewJournalEntry?.Invoke(je); // Always call this on all entries... // filter out commanders, and filter out any UI events if (je.CommanderId == history.CommanderId) { HistoryEntry he = history.AddJournalEntry(je, h => LogLineHighlight(h)); // add a new one on top //System.Diagnostics.Debug.WriteLine("Add HE " + he.EventSummary); OnNewEntry?.Invoke(he, history); // major hook OnNewEntrySecond?.Invoke(he, history); // secondary hook.. } if (je.EventTypeID == JournalTypeEnum.LoadGame) // and issue this on Load game { OnRefreshCommanders?.Invoke(); } }
public void NewEntry(JournalEntry je) // hooked into journal monitor and receives new entries.. Also call if you programatically add an entry { if (je.CommanderId == history.CommanderId) // we are only interested at this point accepting ones for the display commander { foreach (HistoryEntry he in history.AddJournalEntry(je, h => LogLineHighlight(h))) { { OnNewEntry?.Invoke(he, history); // major hook OnNewEntrySecond?.Invoke(he, history); // secondary hook.. } } } OnNewJournalEntry?.Invoke(je); if (je.EventTypeID == JournalTypeEnum.LoadGame) { OnRefreshCommanders?.Invoke(); } }
private void ParseStart() { var structure = GetStructure(); var inps = zip.Entries.Where(entry => entry.Name.EndsWith(".inp")); foreach (var inp in inps) { using (var stream = inp.Open()) { var sr = new StreamReader(stream, Encoding.UTF8); while (!sr.EndOfStream) { var line = sr.ReadLine().Split('\x04'); var names = GetDelimArray(':', line[structure.Author]); var authors = new List <Author>(); foreach (var name in names) { var author = GetDelimArray(',', name, false); authors.Add(new Author { FirstName = SanitizeName(author.Length >= 2 ? author[1] : null), MiddleName = SanitizeName(author.Length >= 3 ? author[2] : null), LastName = SanitizeName(author[0]), }); } var meta = new List <MetaField> { new MetaField { Name = "size", Value = line[structure.Size] }, new MetaField { Name = "libid", Value = line[structure.LibId] }, new MetaField { Name = "del", Value = (line[structure.Del] == "1").ToString() }, }; if (structure.Keywords != -1) { var keywords = GetDelimArray(':', line[structure.Keywords]); foreach (var word in keywords) { meta.Add(new MetaField { Name = "keyword", Value = word }); } } var genresText = GetDelimArray(':', line[structure.Genre]); var genres = new List <Genre>(); foreach (var s in genresText) { var genreTuples = Genres.Localize(s); foreach (var tuple in genreTuples) { genres.Add(new Genre { Name = tuple.Item1, Child = new Genre { Name = tuple.Item2 } }); } } var args = new Book { Authors = authors, Genres = genres, Title = line[structure.Title], Series = SanitizeName(line[structure.Series]), SeriesNo = ParseInt(line[structure.SeriesNo]), File = line[structure.File], Ext = line[structure.Ext], Date = DateTime.Parse(line[structure.Date]), Language = structure.Language != -1 ? line[structure.Language] : null, Archive = inp.Name.Replace(".inp", ".zip"), Meta = meta }; OnNewEntry?.Invoke(this, new NewEntryEventArgs { Book = args }); } } } OnFinished?.Invoke(this); }
public void Add(LogBotEntry entry) { LogEntries.Add(entry); OnNewEntry?.Invoke(this, entry); }