public bool ActionJournalEntry(EDDDLLIF.JournalEntry je)
        {
            if (pDll != IntPtr.Zero && pActionJournalEntry != IntPtr.Zero)
            {
                EDDDLLIF.EDDActionJournalEntry edf = (EDDDLLIF.EDDActionJournalEntry)Marshal.GetDelegateForFunctionPointer(
                    pActionJournalEntry,
                    typeof(EDDDLLIF.EDDActionJournalEntry));
                edf(je);
                return(true);
            }

            return(false);
        }
        // item1 = true if found, item2 = true if caller implements.
        public Tuple <bool, bool> ActionJournalEntry(string dllname, EDDDLLIF.JournalEntry nje)
        {
            if (dllname.Equals("All", StringComparison.InvariantCultureIgnoreCase))
            {
                foreach (EDDDLLCaller caller in dlls)
                {
                    caller.ActionJournalEntry(nje);
                }

                return(new Tuple <bool, bool>(true, true));
            }
            else
            {
                EDDDLLCaller caller = FindCaller(dllname);
                return(caller != null ? new Tuple <bool, bool>(true, caller.ActionJournalEntry(nje)) : new Tuple <bool, bool>(false, false));
            }
        }
        public bool Refresh(string cmdr, EDDDLLIF.JournalEntry je)
        {
            if (pDll != IntPtr.Zero)
            {
                IntPtr pAddressOfFunctionToCall = BaseUtils.Win32.UnsafeNativeMethods.GetProcAddress(pDll, "EDDRefresh");

                if (pAddressOfFunctionToCall != IntPtr.Zero)
                {
                    EDDDLLIF.EDDRefresh edf = (EDDDLLIF.EDDRefresh)Marshal.GetDelegateForFunctionPointer(
                        pAddressOfFunctionToCall,
                        typeof(EDDDLLIF.EDDRefresh));
                    edf(cmdr, je);
                    return(true);
                }
            }

            return(false);
        }
示例#4
0
        static public EDDDLLIF.JournalEntry CreateFromHistoryEntry(EliteDangerousCore.HistoryEntry he)
        {
            if (he == null)
            {
                return(new EDDDLLIF.JournalEntry()
                {
                    ver = 1, indexno = -1
                });
            }
            else
            {
                EDDDLLIF.JournalEntry je = new EDDDLLIF.JournalEntry()
                {
                    ver               = 1,
                    indexno           = he.Indexno,
                    utctime           = he.EventTimeUTC.ToStringZulu(),
                    name              = he.EventSummary,
                    systemname        = he.System.Name,
                    x                 = he.System.X,
                    y                 = he.System.Y,
                    z                 = he.System.Z,
                    travelleddistance = he.TravelledDistance,
                    travelledseconds  = (long)he.TravelledSeconds.TotalSeconds,
                    islanded          = he.IsLanded,
                    isdocked          = he.IsDocked,
                    whereami          = he.WhereAmI,
                    shiptype          = he.ShipType,
                    gamemode          = he.GameMode,
                    group             = he.Group,
                    credits           = he.Credits,
                    eventid           = he.journalEntry.EventTypeStr
                };

                he.journalEntry.FillInformation(out je.info, out je.detailedinfo);

                je.materials       = (from x in he.MaterialCommodity.Sort(false) select x.Details.Name + ":" + x.Count.ToStringInvariant() + ":" + x.Details.FDName).ToArray();
                je.commodities     = (from x in he.MaterialCommodity.Sort(true) select x.Details.Name + ":" + x.Count.ToStringInvariant() + ":" + x.Details.FDName).ToArray();
                je.currentmissions = he.MissionList.GetAllCurrentMissions(he.EventTimeUTC).Select(x => x.DLLInfo()).ToArray();
                return(je);
            }
        }