예제 #1
0
        private void buttonNJE_Click(object sender, EventArgs e)
        {
            EDDDLLInterfaces.EDDDLLIF.JournalEntry nje = new EDDDLLInterfaces.EDDDLLIF.JournalEntry()
            {
                ver = 2, indexno = 19
            };

            nje.utctime      = DateTime.UtcNow.ToString();
            nje.name         = "EventSummary";
            nje.info         = "Info";
            nje.detailedinfo = "DI";
            nje.materials    = new string[2] {
                "one", "two"
            };
            nje.commodities = new string[2] {
                "c-one", "c-two"
            };
            nje.currentmissions = new string[2] {
                "m-one", "m-two"
            };
            nje.systemname        = "Sys Fred";
            nje.x                 = 100.1;
            nje.y                 = 200.1;
            nje.z                 = 300.1;
            nje.travelleddistance = 1234.5;
            nje.travelledseconds  = 6789;
            nje.islanded          = true;
            nje.isdocked          = true;
            nje.whereami          = "Body";
            nje.shiptype          = "Anaconda";
            nje.gamemode          = "Open";
            nje.group             = "Fred";
            nje.credits           = 123456789;
            nje.eventid           = "FunEvent";
            nje.totalrecords      = 2001;
            nje.jid               = 101;
            nje.json              = "{\"timestamp\"=\"10-20\"}";
            nje.cmdrname          = "Buddy";
            nje.cmdrfid           = "F19292";
            nje.shipident         = "Y-1929";
            nje.shipname          = "Julia";
            nje.hullvalue         = 200000;
            nje.modulesvalue      = 20000;
            nje.rebuy             = 5000;
            nje.stored            = false;

            mgr.NewJournalEntry(nje, false);

            richTextBox1.Text += "NJE" + Environment.NewLine;
        }
        private void button3_Click(object sender, EventArgs e)
        {
            EDDDLLIF.JournalEntry nje = new EDDDLLIF.JournalEntry()
            {
                ver = 99, indexno = 19
            };

            nje.utctime      = DateTime.UtcNow.ToString();
            nje.name         = "EventSummary";
            nje.info         = "Info";
            nje.detailedinfo = "DI";
            nje.materials    = new string[2] {
                "one", "two"
            };
            nje.commodities = new string[2] {
                "c-one", "c-two"
            };
            nje.currentmissions = new string[2] {
                "m-one", "m-two"
            };
            nje.systemname        = "Sys Fred";
            nje.x                 = 100.1;
            nje.y                 = 200.1;
            nje.z                 = 300.1;
            nje.travelleddistance = 1234.5;
            nje.travelledseconds  = 6789;
            nje.islanded          = true;
            nje.isdocked          = true;
            nje.whereami          = "Body";
            nje.shiptype          = "Anaconda";
            nje.gamemode          = "Open";
            nje.group             = "Fred";
            nje.credits           = 123456789;
            nje.eventid           = "FunEvent";
            nje.totalrecords      = 2001;
            nje.jid               = 101;

            mgr.NewJournalEntry(nje);

            richTextBox1.Text += "NJE" + Environment.NewLine;
        }
예제 #3
0
        HistoryEntry lastuihe = null;                                       // last he that the ui was updated on.. used during store to try and prevent too much thrash

        public void HistoryEvent(HistoryEntry he, bool stored, bool recent) // recent is true on stored for last few entries..
        {
            bool dontupdateui = (lasthe != null && stored && !recent);

            if (!dontupdateui)      // so, if we have displayed one, and we are in stored reply, and not a recent entry.. don't update UI
            {
                bool reposbut = false;

                if (lastuihe == null || !he.Commander.Name.Equals(lastuihe.Commander.Name))
                {
                    labelCmdr.Text = he.Commander.Name;
                    if (EDCommander.Current.Name != he.Commander.Name)
                    {
                        labelCmdr.Text += " Report clash " + EDCommander.Current.Name;
                    }
                }

                if (lastuihe == null || he.Credits != lastuihe.Credits)
                {
                    labelCredits.Text = he.Credits.ToString("N0");
                }

                if (!labelSystem.Text.Equals(he.System.Name))       // because of StartJump rewriting the previous entry, we can't detect system names changes using UI
                {                                                   // which ends up we never seeing lastui.system.name being different to he.system.name
                    extButtonEDSMSystem.Enabled = extButtonInaraSystem.Enabled = extButtonEDDBSystem.Enabled = true;
                    labelSystem.Text            = he.System.Name;
                    reposbut = true;
                }

                if (lastuihe == null || !he.WhereAmI.Equals(lastuihe.WhereAmI))
                {
                    labelLocation.Text = he.WhereAmI;
                    reposbut           = true;
                }

                bool hasmarketid       = he?.MarketID.HasValue ?? false;
                bool hasbodyormarketid = hasmarketid || he.FullBodyID.HasValue;

                if (lastuihe == null || extButtonInaraStation.Enabled != hasmarketid)
                {
                    extButtonInaraStation.Enabled = extButtonEDDBStation.Enabled = hasmarketid;
                }

                if (lastuihe == null || extButtonSpanshStation.Enabled != hasbodyormarketid)
                {
                    extButtonSpanshStation.Enabled = hasbodyormarketid;
                }

                if ((he.ShipInformation != null) != extButtonEDSY.Enabled)      // enabled/visible causes effort, only do it if different
                {
                    extButtonEDSY.Enabled = extButtonCoriolis.Enabled = he.ShipInformation != null;
                }

                if (he.ShipInformation != null && (lastuihe == null || lastuihe.ShipInformation == null || he.ShipInformation.ShipNameIdentType != lastuihe.ShipInformation.ShipNameIdentType))
                {
                    labelShip.Text = he.ShipInformation.ShipNameIdentType ?? "Unknown";
                    reposbut       = true;
                }

                if (reposbut)
                {
                    int maxx = Math.Max(labelSystem.Right, labelLocation.Right) + 2;

                    extButtonEDSMSystem.Left   = maxx;
                    extButtonInaraSystem.Left  = extButtonEDSMSystem.Right + 2;
                    extButtonEDDBSystem.Left   = extButtonInaraSystem.Right + 2;
                    extButtonSpanshSystem.Left = extButtonEDDBSystem.Right + 2;

                    extButtonInaraStation.Left  = maxx;
                    extButtonEDDBStation.Left   = extButtonInaraStation.Right + 2;
                    extButtonSpanshStation.Left = extButtonEDDBStation.Right + 2;

                    extButtonCoriolis.Left = labelShip.Right + 2;
                    extButtonEDSY.Left     = extButtonCoriolis.Right + 2;
                }

                if (lastuihe == null || he.MaterialCommodity.DataCount != lastuihe.MaterialCommodity.DataCount || he.MaterialCommodity.CargoCount != lastuihe.MaterialCommodity.CargoCount ||
                    he.MaterialCommodity.MaterialsCount != lastuihe.MaterialCommodity.MaterialsCount)
                {
                    labelData.Text      = he.MaterialCommodity.DataCount.ToString();
                    labelCargo.Text     = he.MaterialCommodity.CargoCount.ToString();
                    labelMaterials.Text = he.MaterialCommodity.MaterialsCount.ToString();
                }

                he.journalEntry.FillInformation(out string info, out string detailed);
                LogLine(EDDConfig.Instance.ConvertTimeToSelectedFromUTC(he.EventTimeUTC) + " " + he.journalEntry.SummaryName(he.System) + ": " + info);

                if (he.MissionList != null)
                {
                    labelMissionCount.Text = he.MissionList.Missions.Count.ToString();
                    string mtext = "";
                    if (he.MissionList.Missions.Count > 0)
                    {
                        var list = he.MissionList.GetAllCurrentMissions(DateTime.Now);
                        if (list.Count > 0)
                        {
                            var last = list[0];
                            mtext = BaseUtils.FieldBuilder.Build("", last.Mission.LocalisedName, "", last.Mission.Expiry, "", last.Mission.DestinationSystem, "", last.Mission.DestinationStation);
                        }
                    }

                    labelLatestMission.Text = mtext;
                }

                lastuihe = he;
                System.Diagnostics.Debug.WriteLine("Set lastuihe to " + lastuihe.System.Name);
            }

            if (!stored)
            {
                if (he.Commander.SyncToEdsm)
                {
                    EDSMJournalSync.SendEDSMEvents(LogLine, he);
                }

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

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

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

                screenshot.NewJournalEntry(he.journalEntry);
            }

            if (DLLManager.Count > 0)       // if worth calling..
            {
                DLLManager.NewJournalEntry(EDDDLLCallerHE.CreateFromHistoryEntry(he, stored), stored);
            }

            lasthe = he;
        }
        private void buttonNJE_Click(object sender, EventArgs e)
        {
            EDDDLLInterfaces.EDDDLLIF.JournalEntry nje = new EDDDLLInterfaces.EDDDLLIF.JournalEntry()
            {
                ver = 5, indexno = 19
            };

            //v1
            nje.utctime      = DateTime.UtcNow.ToString();
            nje.name         = "EventSummary";
            nje.info         = "Info";
            nje.detailedinfo = "DI";
            nje.materials    = new string[2] {
                "one", "two"
            };
            nje.commodities = new string[2] {
                "c-one", "c-two"
            };
            nje.currentmissions = new string[2] {
                "m-one", "m-two"
            };
            nje.systemname        = "Sys Fred";
            nje.x                 = 100.1;
            nje.y                 = 200.1;
            nje.z                 = 300.1;
            nje.travelleddistance = 1234.5;
            nje.travelledseconds  = 6789;
            nje.islanded          = true;
            nje.isdocked          = true;
            nje.whereami          = "Body";
            nje.shiptype          = "Anaconda";
            nje.gamemode          = "Open";
            nje.group             = "Fred";
            nje.credits           = 0xCCC12345678;
            nje.eventid           = "FunEvent";
            nje.jid               = 0xAAA12345678;
            nje.totalrecords      = 2001;

            //v2
            nje.json         = "{\"timestamp\"=\"10-20\"}";
            nje.cmdrname     = "Buddy";
            nje.cmdrfid      = "F19292";
            nje.shipident    = "Y-1929";
            nje.shipname     = "Julia";
            nje.hullvalue    = 0x12345678;
            nje.rebuy        = 0x1234000;
            nje.modulesvalue = 0x1234111;
            nje.stored       = true;

            //v3
            nje.travelstate    = "Travelling";
            nje.microresources = new string[] { "MR1", "MR2", "MR3" };

            // v4
            nje.horizons = false;
            nje.odyssey  = true;
            nje.beta     = false;

            //v5
            nje.wanted         = false;
            nje.bodyapproached = true;
            nje.bookeddropship = false;
            nje.issrv          = true;
            nje.isfighter      = false;
            nje.onfoot         = true;
            nje.bookedtaxi     = false;

            nje.bodyname          = "Bodyname";
            nje.bodytype          = "Bodytype";
            nje.stationname       = "stationname";
            nje.stationtype       = "stationtype";
            nje.stationfaction    = "stationfaction";
            nje.shiptypefd        = "shiptypefd";
            nje.oncrewwithcaptain = "Captain Jack";
            nje.shipid            = 0xa1a12345678;
            nje.bodyid            = 2020;

            mgr.NewJournalEntry(nje, false);

            richTextBox1.Text += "NJE" + Environment.NewLine;
        }
예제 #5
0
        public void HistoryEvent(HistoryEntry he, bool stored)
        {
            if (lasthe == null || he.Commander.Name != lasthe.Commander.Name)
            {
                labelCmdr.Text = he.Commander.Name;
                if (EDCommander.Current.Name != he.Commander.Name)
                {
                    labelCmdr.Text += " Report clash " + EDCommander.Current.Name;
                }
            }

            if (lasthe == null || he.System.Name != lasthe.System.Name)
            {
                extButtonEDSM.Enabled        = true;
                extButtonInaraSystem.Enabled = true;
                labelSystem.Text             = he.System.Name;
            }

            if (lasthe == null || he.WhereAmI != lasthe.WhereAmI)
            {
                labelLocation.Text = he.WhereAmI;
            }

            extButtonEDSY.Enabled = extButtonCoriolis.Enabled = he.ShipInformation != null;

            if (he.ShipInformation != null && (lasthe == null || lasthe.ShipInformation == null || he.ShipInformation.ShipNameIdentType != lasthe.ShipInformation.ShipNameIdentType))
            {
                labelShip.Text = he.ShipInformation.ShipNameIdentType ?? "Unknown";
            }

            if (lasthe == null || he.MaterialCommodity.DataCount != lasthe.MaterialCommodity.DataCount || he.MaterialCommodity.CargoCount != lasthe.MaterialCommodity.CargoCount ||
                he.MaterialCommodity.MaterialsCount != lasthe.MaterialCommodity.MaterialsCount)
            {
                labelData.Text      = he.MaterialCommodity.DataCount.ToString();
                labelCargo.Text     = he.MaterialCommodity.CargoCount.ToString();
                labelMaterials.Text = he.MaterialCommodity.MaterialsCount.ToString();
            }

            if (lasthe == null || he.Credits != lasthe.Credits)
            {
                labelCredits.Text = he.Credits.ToString("N0");
            }

            he.journalEntry.FillInformation(out string info, out string detailed);
            LogLine(he.EventTimeUTC + " " + he.journalEntry.EventTypeStr + " " + info);

            extButtonInaraStation.Enabled = he.IsDocked;

            if (he.MissionList != null)
            {
                labelMissionCount.Text = he.MissionList.Missions.Count.ToString();
                string mtext = "";
                if (he.MissionList.Missions.Count > 0)
                {
                    var list = he.MissionList.GetAllCurrentMissions(DateTime.Now);
                    if (list.Count > 0)
                    {
                        var last = list[0];
                        mtext = BaseUtils.FieldBuilder.Build("", last.Mission.LocalisedName, "", last.Mission.Expiry, "", last.Mission.DestinationSystem, "", last.Mission.DestinationStation);
                    }
                }

                labelLatestMission.Text = mtext;
            }

            lasthe = he;

            if (!stored)
            {
                if (he.Commander.SyncToEdsm)
                {
                    EDSMJournalSync.SendEDSMEvents(LogLine, he);
                }

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

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

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

                if (DLLManager.Count > 0)       // if worth calling..
                {
                    DLLManager.NewJournalEntry(EDDDLLCallerHE.CreateFromHistoryEntry(he));
                }

                screenshot.NewJournalEntry(he.journalEntry);
            }
        }