Пример #1
0
        private bool ReadJournalLog(out JournalReaderEntry jent, bool resetOnError = false)
        {
            if (StartEntries.Count != 0 && this.TravelLogUnit.CommanderId != null && this.TravelLogUnit.CommanderId >= 0)
            {
                jent = StartEntries.Dequeue();
                jent.JournalEntry.CommanderId = (int)TravelLogUnit.CommanderId;
                return(true);
            }

            while (ReadLine(out jent, l => ProcessLine(l, resetOnError)))
            {
                if (jent == null)
                {
                    continue;
                }

                if ((this.TravelLogUnit.CommanderId == null || this.TravelLogUnit.CommanderId < 0) && jent.JournalEntry.EventTypeID != JournalTypeEnum.LoadGame)
                {
                    StartEntries.Enqueue(jent);
                    continue;
                }

                //System.Diagnostics.Trace.WriteLine(string.Format("Read line {0} from {1}", line, this.FileName));

                return(true);
            }

            jent = null;
            return(false);
        }
Пример #2
0
        // this class looks at the JE and decides if its really a UI not a journal entry

        private void AddEntry(JournalReaderEntry newentry, ref List <JournalReaderEntry> jent, ref List <UIEvent> uievents)
        {
            if (newentry.JournalEntry.EventTypeID == JournalTypeEnum.Music)     // MANUALLY sync this list with ActionEventList.cs::EventList function
            {
                var jm = newentry.JournalEntry as JournalEvents.JournalMusic;
                uievents.Add(new UIEvents.UIMusic(jm.MusicTrack, jm.MusicTrackID, jm.EventTimeUTC, false));
                return;
            }
            else if (newentry.JournalEntry.EventTypeID == JournalTypeEnum.UnderAttack)
            {
                var ja = newentry.JournalEntry as JournalEvents.JournalUnderAttack;
                uievents.Add(new UIEvents.UIUnderAttack(ja.Target, ja.EventTimeUTC, false));
                return;
            }
            else if (newentry.JournalEntry.EventTypeID == JournalTypeEnum.SendText)
            {
                var jt = newentry.JournalEntry as JournalEvents.JournalSendText;
                if (jt.Command)
                {
                    uievents.Add(new UIEvents.UICommand(jt.Message, jt.To, jt.EventTimeUTC, false));
                    return;
                }
            }
            else if (newentry.JournalEntry.EventTypeID == JournalTypeEnum.ShipTargeted)
            {
                var jst = newentry.JournalEntry as JournalEvents.JournalShipTargeted;
                if (jst.TargetLocked == false)
                {
                    uievents.Add(new UIEvents.UIShipTargeted(jst, jst.EventTimeUTC, false));
                    return;
                }
            }
            else if (newentry.JournalEntry.EventTypeID == JournalTypeEnum.ReceiveText)
            {
                var jt = newentry.JournalEntry as JournalEvents.JournalReceiveText;
                if (jt.Channel == "Info")
                {
                    uievents.Add(new UIEvents.UIReceiveText(jt, jt.EventTimeUTC, false));
                    return;
                }
            }
            else if (newentry.JournalEntry.EventTypeID == JournalTypeEnum.FSDTarget)
            {
                var jt = newentry.JournalEntry as JournalEvents.JournalFSDTarget;
                uievents.Add(new UIEvents.UIFSDTarget(jt, jt.EventTimeUTC, false));
                return;
            }

            jent.Add(newentry);
        }