public void Init() // ED Discovery calls this during its init { TraceLog.LogFileWriterException += ex => // now we can attach the log writing highter into it { LogLineHighlight($"Log Writer Exception: {ex}"); }; galacticMapping = new GalacticMapping(); EdsmLogFetcher = new EDSMLogFetcher(LogLine); EdsmLogFetcher.OnDownloadedSystems += () => RefreshHistoryAsync(); journalmonitor = new EDJournalUIScanner(InvokeAsyncOnUiThread); journalmonitor.OnNewJournalEntry += NewEntry; journalmonitor.OnNewUIEvent += NewUIEvent; }
// ED Discovery calls this during its init to allow the controller to set some things up public void Init() { TraceLog.LogFileWriterException += ex => // now we can attach the log writing highter into it { LogLineHighlight($"Log Writer Exception: {ex}"); }; EdsmLogFetcher = new EDSMLogFetcher(LogLine); EdsmLogFetcher.OnDownloadedSystems += () => RefreshHistoryAsync(); journalmonitor = new EDJournalUIScanner(InvokeAsyncOnUiThread); journalmonitor.OnNewJournalEntry += NewJournalEntryFromScanner; journalmonitor.OnNewUIEvent += NewUIEventFromScanner; FrontierCAPI = new CAPI.CompanionAPI(EDDOptions.Instance.CAPIDirectory(), CAPI.CapiClientIdentity.id, EDDApplicationContext.UserAgent, "eddiscovery"); DDEServer = new BaseUtils.DDE.DDEServer(); // will be started in shown }
private void Controller() { journalmonitor = new EDJournalUIScanner(InvokeAsyncOnUiThread); journalmonitor.OnNewJournalEntry += (je) => { Entry(je, false, true); }; journalmonitor.OnNewUIEvent += (ui) => { InvokeAsyncOnUiThread(() => NewUI?.Invoke(ui)); }; LogLine?.Invoke("Detecting Journals"); Reset(); journalmonitor.SetupWatchers(); // order the reading of last 2 files (in case continue) and fire back the last two LogLine?.Invoke("Reading Journals"); journalmonitor.ParseJournalFilesOnWatchers(UpdateWatcher, 2, (a, ji, jt, ei, et) => InvokeAsyncOnUiThread(() => { // System.Diagnostics.Debug.WriteLine("In FG {0} {1} {2} {3} {4} {5}", EDCommander.GetCommander(a.CommanderId).Name, ji, jt, ei, et, a.EventTypeStr ); Entry(a, true, ei - et > -recentlimit); }), 2); InvokeAsyncOnUiThread(() => { RefreshFinished?.Invoke(currenthe); }); LogLine?.Invoke("Finished reading Journals"); journalmonitor.StartMonitor(false); while (!stopit) { if (RequestRescan) { RequestRescan = false; LogLine?.Invoke("Re-reading Journals"); journalmonitor.StopMonitor(); Reset(); journalmonitor.SetupWatchers(); journalmonitor.ParseJournalFilesOnWatchers(UpdateWatcher, 2, (a, ji, jt, ei, et) => InvokeAsyncOnUiThread(() => { Entry(a, true, ei - et > -recentlimit); }), 2); journalmonitor.StartMonitor(false); InvokeAsyncOnUiThread(() => { RefreshFinished?.Invoke(currenthe); }); LogLine?.Invoke("Finished reading Journals"); } Thread.Sleep(100); } journalmonitor.StopMonitor(); }
private void Controller() { journalmonitor = new EDJournalUIScanner(InvokeAsyncOnUiThread); journalmonitor.OnNewJournalEntry += (je) => { Entry(je, false); }; journalmonitor.OnNewUIEvent += (ui) => { InvokeAsyncOnUiThread(() => NewUI?.Invoke(ui)); }; LogLine?.Invoke("Reading Journals"); Reset(); journalmonitor.SetupWatchers(); // order the reading of last 2 files (in case continue) and fire back the last two journalmonitor.ParseJournalFilesOnWatchers(UpdateWatcher, 2, (a) => InvokeAsyncOnUiThread(() => { Entry(a, true); }), 2); InvokeAsyncOnUiThread(() => { Refresh?.Invoke(currenthe); }); LogLine?.Invoke("Finished reading Journals"); journalmonitor.StartMonitor(); while (!stopit) { if (RequestRescan) { RequestRescan = false; LogLine?.Invoke("Re-reading Journals"); journalmonitor.StopMonitor(); Reset(); journalmonitor.SetupWatchers(); journalmonitor.ParseJournalFilesOnWatchers(UpdateWatcher, 2, (a) => InvokeAsyncOnUiThread(() => { Entry(a, true); }), 2); journalmonitor.StartMonitor(); InvokeAsyncOnUiThread(() => { Refresh?.Invoke(currenthe); }); LogLine?.Invoke("Finished reading Journals"); } Thread.Sleep(100); } journalmonitor.StopMonitor(); }