コード例 #1
0
 private void sendUnsyncedScanToEDDNToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (rightclicksystem != null && EDDNClass.IsDelayableEDDNMessage(rightclicksystem.EntryType, rightclicksystem.EventTimeUTC) && !rightclicksystem.EDDNSync)
     {
         EDDNSync.SendEDDNEvent(discoveryform.LogLine, rightclicksystem);
     }
 }
コード例 #2
0
 private void sendUnsyncedScanToEDDNToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (rightclicksystem != null && rightclicksystem.EntryType == JournalTypeEnum.Scan && !rightclicksystem.EDDNSync)
     {
         EDDNSync.SendEDDNEvent(discoveryform.LogLine, rightclicksystem);
     }
 }
コード例 #3
0
        // Called after HE removal/reorder, and after the UI's has had a chance to operate
        private void Controller_NewEntrySecond(HistoryEntry he, HistoryList hl)
        {
            BaseUtils.AppTicks.TickCountLapDelta("DFS", true);

            actioncontroller.ActionRunOnEntry(he, Actions.ActionEventEDList.NewEntry(he));

            var t1 = BaseUtils.AppTicks.TickCountLapDelta("DFS");

            if (t1.Item2 >= 80)
            {
                System.Diagnostics.Trace.WriteLine("NE Second Actions slow " + t1.Item1);
            }

            // all notes committed
            SystemNoteClass.CommitDirtyNotes((snc) => { if (EDCommander.Current.SyncToEdsm && snc.FSDEntry)
                                                        {
                                                            EDSMClass.SendComments(snc.SystemName, snc.Note, 0, he.Commander);
                                                        }
                                             });

            if (he.IsFSDCarrierJump)
            {
                int count = history.GetVisitsCount(he.System.Name);
                LogLine(string.Format("Arrived at system {0} Visit No. {1}".T(EDTx.EDDiscoveryForm_Arrived), he.System.Name, count));
                System.Diagnostics.Trace.WriteLine("Arrived at system: " + he.System.Name + " " + count + ":th visit.");
            }

            if (EDCommander.Current.SyncToIGAU)
            {
                EliteDangerousCore.IGAU.IGAUSync.NewEvent(LogLine, he);
            }

            if (EDCommander.Current.SyncToEDAstro)
            {
                EliteDangerousCore.EDAstro.EDAstroSync.SendEDAstroEvents(new List <HistoryEntry>()
                {
                    he
                });
            }

            if (EDDNClass.IsEDDNMessage(he.EntryType) && he.AgeOfEntry() < TimeSpan.FromDays(1.0) && EDCommander.Current.SyncToEddn == true)
            {
                EDDNSync.SendEDDNEvents(LogLine, new List <HistoryEntry> {
                    he
                });
            }

            if (DLLManager.Count > 0)
            {
                DLLManager.NewJournalEntry(EliteDangerousCore.DLL.EDDDLLCallerHE.CreateFromHistoryEntry(history, he), false);
            }

            ScreenshotConverter.NewJournalEntry(he.journalEntry);       // tell the screenshotter.

            CheckActionProfile(he);
        }
コード例 #4
0
 public void Shutdown()
 {
     if (!PendingClose)
     {
         PendingClose = true;
         EDDNSync.StopSync();
         EdsmSync.StopSync();
         EdsmLogFetcher.AsyncStop();
         journalmonitor.StopMonitor();
         LogLineHighlight("Closing down, please wait..");
         Console.WriteLine("Close.. safe close launched");
         closeRequested.Set();
     }
 }
コード例 #5
0
 public void Shutdown()
 {
     if (!PendingClose)
     {
         PendingClose = true;
         EDDNSync.StopSync();
         EDSMJournalSync.StopSync();
         EdsmLogFetcher.AsyncStop();
         journalmonitor.StopMonitor();
         LogLineHighlight("Closing down, please wait..".Tx(this, "CD"));
         closeRequested.Set();
         journalqueuedelaytimer.Change(Timeout.Infinite, Timeout.Infinite);
         journalqueuedelaytimer.Dispose();
     }
 }
コード例 #6
0
 public void Shutdown()      // called to request a shutdown.. background thread co-ords the shutdown.
 {
     if (!PendingClose)
     {
         PendingClose = true;
         EDDNSync.StopSync();
         EDSMJournalSync.StopSync();
         EdsmLogFetcher.AsyncStop();
         journalmonitor.StopMonitor();
         LogLineHighlight("Closing down, please wait..".T(EDTx.EDDiscoveryController_CD));
         closeRequested.Set();
         journalqueuedelaytimer.Change(Timeout.Infinite, Timeout.Infinite);
         journalqueuedelaytimer.Dispose();
     }
 }
コード例 #7
0
        // main travel grid has a new entry due to onNewEntry
        public void UpdatedWithAddNewEntry(HistoryEntry he, HistoryList hl, bool accepted)
        {
            try
            {   // try is a bit old, probably do not need it.
                if (he.IsFSDJump)
                {
                    int count = _discoveryForm.history.GetVisitsCount(he.System.name);
                    _discoveryForm.LogLine(string.Format("Arrived at system {0} Visit No. {1}", he.System.name, count));

                    System.Diagnostics.Trace.WriteLine("Arrived at system: " + he.System.name + " " + count + ":th visit.");

                    if (EDCommander.Current.SyncToEdsm == true)
                    {
                        EDSMSync.SendTravelLog(he);
                        _discoveryForm.ActionRunOnEntry(he, Actions.ActionEventEDList.onEDSMSync);
                    }
                }

                hl.SendEDSMStatusInfo(he, true);

                if (he.ISEDDNMessage && he.AgeOfEntry() < TimeSpan.FromDays(1.0))
                {
                    if (EDCommander.Current.SyncToEddn == true)
                    {
                        EDDNSync.SendEDDNEvents(_discoveryForm.LogLine, he);
                        _discoveryForm.ActionRunOnEntry(he, Actions.ActionEventEDList.onEDDNSync);
                    }
                }

                if (he.EntryType == JournalTypeEnum.Scan)
                {
                    if (EDCommander.Current.SyncToEGO)
                    {
                        EDDiscoveryCore.EGO.EGOSync.SendEGOEvents(_discoveryForm.LogLine, he);
                        _discoveryForm.ActionRunOnEntry(he, Actions.ActionEventEDList.onEGOSync);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("Exception NewPosition: " + ex.Message);
                System.Diagnostics.Trace.WriteLine("Trace: " + ex.StackTrace);
            }
        }
コード例 #8
0
        public void UpdatedWithAddNewEntry(HistoryEntry he, HistoryList hl, bool accepted)     // main travel grid calls after getting a new entry
        {
            try
            {   // try is a bit old, probably do not need it.
                if (he.IsFSDJump)
                {
                    int count = _discoveryForm.history.GetVisitsCount(he.System.name);
                    _discoveryForm.LogLine(string.Format("Arrived at system {0} Visit No. {1}", he.System.name, count));

                    System.Diagnostics.Trace.WriteLine("Arrived at system: " + he.System.name + " " + count + ":th visit.");

                    if (EDCommander.Current.SyncToEdsm == true)
                    {
                        EDSMSync.SendTravelLog(he);
                    }
                }

                if (he.ISEDDNMessage)
                {
                    if (EDCommander.Current.SyncToEddn == true)
                    {
                        EDDNSync.SendEDDNEvents(_discoveryForm, he);
                    }
                }

                if (accepted)                                         // if accepted it on main grid..
                {
                    RefreshTargetDisplay();                           // tell the target system its changed the latest system

                    if (EDDiscoveryForm.EDDConfig.FocusOnNewSystem)   // Move focus to new row
                    {
                        userControlTravelGrid.SelectTopRow();
                        ShowSystemInformation(userControlTravelGrid.GetCurrentRow);
                        UpdateDependentsWithSelection();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("Exception NewPosition: " + ex.Message);
                System.Diagnostics.Trace.WriteLine("Trace: " + ex.StackTrace);
            }
        }
コード例 #9
0
        private void Controller_NewEntrySecond(HistoryEntry he, HistoryList hl)         // called after all UI's have had their chance
        {
            BaseUtils.AppTicks.TickCountLapDelta("DFS", true);

            actioncontroller.ActionRunOnEntry(he, Actions.ActionEventEDList.NewEntry(he));

            var t1 = BaseUtils.AppTicks.TickCountLapDelta("DFS");

            if (t1.Item2 >= 80)
            {
                System.Diagnostics.Trace.WriteLine("NE Second Actions slow " + t1.Item1);
            }

            // all notes committed
            SystemNoteClass.CommitDirtyNotes((snc) => { if (EDCommander.Current.SyncToEdsm && snc.FSDEntry)
                                                        {
                                                            EDSMClass.SendComments(snc.SystemName, snc.Note, 0, he.Commander);
                                                        }
                                             });

            var lastent = history.GetLast;

            if (!object.ReferenceEquals(he, lastent))
            {
                LogLineHighlight(string.Format("Current history entry is not last in history - possible re-entrancy.\nAlert the EDDiscovery developers using either discord or Github (see help) and attach log file {0}", BaseUtils.TraceLog.LogFileName));
                Trace.WriteLine($"Current history entry is not last in history");
                Trace.WriteLine($"Current entry: {he.journalEntry?.GetJsonString()}");
                Trace.WriteLine($"Last entry: {lastent.journalEntry?.GetJsonString()}");
                Trace.WriteLine($"Stack Trace:");
                Trace.WriteLine(new StackTrace(true).ToString());
            }

            if (he.IsFSDCarrierJump)
            {
                int count = history.GetVisitsCount(he.System.Name);
                LogLine(string.Format("Arrived at system {0} Visit No. {1}".T(EDTx.EDDiscoveryForm_Arrived), he.System.Name, count));
                System.Diagnostics.Trace.WriteLine("Arrived at system: " + he.System.Name + " " + count + ":th visit.");
            }

            if (EDCommander.Current.SyncToEdsm && EDSMJournalSync.OkayToSend(he))           // send this one, if allowed.
            {
                EDSMJournalSync.SendEDSMEvents(LogLine, new List <HistoryEntry>()
                {
                    he
                });                                                                             // send, if bad credentials, EDSM will moan alerting the user
            }

            if (EDCommander.Current.SyncToInara)
            {
                EliteDangerousCore.Inara.InaraSync.NewEvent(LogLine, hl, he);
            }

            if (EDCommander.Current.SyncToIGAU)
            {
                EliteDangerousCore.IGAU.IGAUSync.NewEvent(LogLine, he);
            }

            if (EDCommander.Current.SyncToEDAstro)
            {
                EliteDangerousCore.EDAstro.EDAstroSync.SendEDAstroEvents(new List <HistoryEntry>()
                {
                    he
                });
            }

            if (EDDNClass.IsEDDNMessage(he.EntryType) && he.AgeOfEntry() < TimeSpan.FromDays(1.0) && EDCommander.Current.SyncToEddn == true)
            {
                EDDNSync.SendEDDNEvents(LogLine, he);
            }



            DLLManager.NewJournalEntry(EliteDangerousCore.DLL.EDDDLLCallerHE.CreateFromHistoryEntry(history, he), false);

            screenshotconverter.NewJournalEntry(he.journalEntry);       // tell the screenshotter.

            CheckActionProfile(he);
        }
コード例 #10
0
        private void Controller_NewEntrySecond(HistoryEntry he, HistoryList hl)         // called after all UI's have had their chance
        {
            BaseUtils.AppTicks.TickCountLapDelta("DFS", true);

            actioncontroller.ActionRunOnEntry(he, Actions.ActionEventEDList.NewEntry(he));

            var t1 = BaseUtils.AppTicks.TickCountLapDelta("DFS");

            if (t1.Item2 >= 80)
            {
                System.Diagnostics.Trace.WriteLine("NE Second Actions slow " + t1.Item1);
            }

            // all notes committed
            SystemNoteClass.CommitDirtyNotes((snc) => { if (EDCommander.Current.SyncToEdsm && snc.FSDEntry)
                                                        {
                                                            EDSMClass.SendComments(snc.SystemName, snc.Note, 0, he.Commander);
                                                        }
                                             });

            var lastent = history.GetLast;

            if (!object.ReferenceEquals(he, lastent))
            {
                LogLineHighlight(string.Format("Current history entry is not last in history - possible re-entrancy.\nAlert the EDDiscovery developers using either discord or Github (see help) and attach log file {0}", BaseUtils.TraceLog.LogFileName));
                Trace.WriteLine($"Current history entry is not last in history");
                Trace.WriteLine($"Current entry: {he.journalEntry?.GetJsonString()}");
                Trace.WriteLine($"Last entry: {lastent.journalEntry?.GetJsonString()}");
                Trace.WriteLine($"Stack Trace:");
                Trace.WriteLine(new StackTrace(true).ToString());
            }

            if (he.IsFSDCarrierJump)
            {
                int count = history.GetVisitsCount(he.System.Name);
                LogLine(string.Format("Arrived at system {0} Visit No. {1}".T(EDTx.EDDiscoveryForm_Arrived), he.System.Name, count));
                System.Diagnostics.Trace.WriteLine("Arrived at system: " + he.System.Name + " " + count + ":th visit.");
            }

            if (EDCommander.Current.SyncToEdsm && EDSMJournalSync.OkayToSend(he))           // send this one, if allowed.
            {
                EDSMJournalSync.SendEDSMEvents(LogLine, new List <HistoryEntry>()
                {
                    he
                });                                                                             // send, if bad credentials, EDSM will moan alerting the user
            }

            if (EDCommander.Current.SyncToInara)
            {
                EliteDangerousCore.Inara.InaraSync.NewEvent(LogLine, he);
            }

            if (EDCommander.Current.SyncToIGAU)
            {
                EliteDangerousCore.IGAU.IGAUSync.NewEvent(LogLine, he);
            }

            if (EDDNClass.IsEDDNMessage(he.EntryType) && he.AgeOfEntry() < TimeSpan.FromDays(1.0) && EDCommander.Current.SyncToEddn == true)
            {
                EDDNSync.SendEDDNEvents(LogLine, he);
            }

            DLLManager.NewJournalEntry(EliteDangerousCore.DLL.EDDDLLCallerHE.CreateFromHistoryEntry(history, he), false);

            screenshotconverter.NewJournalEntry(he.journalEntry);       // tell the screenshotter.

            CheckActionProfile(he);

            // finally, CAPI, if docked, try and get commodity data, and if so, create a new EDD record
            // placed here because it causes a new set of newentries to be called

            if (he.EntryType == JournalTypeEnum.Docked && FrontierCAPI.Active)
            {
                System.Threading.Tasks.Task.Run(() =>           // don't hold up the main thread, do it in a task, as its a HTTP operation
                {
                    var dockevt = he.journalEntry as EliteDangerousCore.JournalEvents.JournalDocked;

                    string marketjson = FrontierCAPI.Market();

                    CAPI.Market mk = new CAPI.Market(marketjson);
                    if (mk.IsValid)
                    {
                        System.IO.File.WriteAllText(@"c:\code\market.json", marketjson);

                        if (dockevt.StationName.Equals(mk.Name, StringComparison.InvariantCultureIgnoreCase))
                        {
                            System.Diagnostics.Debug.WriteLine($"CAPI got market {mk.Name}");

                            var entry = new EliteDangerousCore.JournalEvents.JournalEDDCommodityPrices(he.EventTimeUTC.AddSeconds(1),
                                                                                                       mk.ID, mk.Name, he.System.Name, EDCommander.CurrentCmdrID, mk.Commodities);

                            var jo = entry.ToJSON();        // get json of it, and add it to the db
                            entry.Add(jo);

                            BeginInvoke((System.Windows.Forms.MethodInvoker) delegate
                            {
                                Debug.Assert(System.Windows.Forms.Application.MessageLoop);
                                System.Diagnostics.Debug.WriteLine("CAPI fire new entry");
                                NewEntry(entry);                // then push it thru. this will cause another set of calls to NewEntry First/Second
                                                                // EDDN handler will pick up EDDCommodityPrices and send it.
                            });
                        }
                        else
                        {
                            System.Diagnostics.Trace.WriteLine($"CAPI disagree on market {dockevt.StationName} vs {mk.Name}");
                        }
                    }
                    else
                    {
                        System.Diagnostics.Trace.WriteLine($"CAPI market invalid {marketjson}");
                    }
                });
            }
        }
コード例 #11
0
        private void sendUnsuncedEDDNEventsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <HistoryEntry> hlsyncunsyncedlist = Controller.history.FilterByScanNotEDDNSynced;        // first entry is oldest

            EDDNSync.SendEDDNEvents(this, hlsyncunsyncedlist);
        }