Пример #1
0
        // on UI thread. hooked into journal monitor and receives new entries.. Also call if you programatically add an entry
        // sr may be null if programatically made, not read from logs. Only a few events are made this way, check the references.
        public void NewJournalEntryFromScanner(JournalEntry je, StatusReader sr)
        {
            Debug.Assert(System.Windows.Forms.Application.MessageLoop);

            if (je.EventTypeID == JournalTypeEnum.CodexEntry)
            {
                System.Diagnostics.Debug.Assert(sr != null, "Made codex programatically - wrong");
                var jce = je as EliteDangerousCore.JournalEvents.JournalCodexEntry;
                jce.EDDBodyName = sr.BodyName;     // copy in the SR Body name to the entry - this is a feed thru of status to the entry
                System.Diagnostics.Debug.WriteLine($"Journal Codex set body name to {jce.EDDBodyName} due to status record");
            }

            int playdelay = HistoryList.MergeTypeDelayForJournalEntries(je); // see if there is a delay needed..

            if (playdelay > 0)                                               // if delaying to see if a companion event occurs. add it to list. Set timer so we pick it up
            {
                System.Diagnostics.Debug.WriteLine(Environment.TickCount + " Delay Play queue " + je.EventTypeID + " Delay for " + playdelay);
                journalqueue.Enqueue(je);
                journalqueuedelaytimer.Change(playdelay, Timeout.Infinite);
            }
            else
            {
                journalqueuedelaytimer.Change(Timeout.Infinite, Timeout.Infinite); // stop the timer, but if it occurs before this, not the end of the world
                journalqueue.Enqueue(je);                                          // add it to the play list.
                //System.Diagnostics.Debug.WriteLine(Environment.TickCount + " No delay, issue " + je.EventTypeID );
                PlayJournalList();                                                 // and play
            }
        }
Пример #2
0
        // New UI event. SR will be null if programatically made

        void NewUIEventFromScanner(UIEvent u, StatusReader sr)                  // UI thread new event
        {
            Debug.Assert(System.Windows.Forms.Application.MessageLoop);
            //System.Diagnostics.Debug.WriteLine("Dispatch from controller UI event " + u.EventTypeStr);

            BaseUtils.AppTicks.TickCountLapDelta("CTUI", true);

            var uifuel = u as EliteDangerousCore.UIEvents.UIFuel;       // UI Fuel has information on fuel level - update it.

            if (uifuel != null && history != null)
            {
                history.ShipInformationList.UIFuel(uifuel);                                          // update the SI global value
                if (history.ShipInformationList.CurrentShip != null)                                 // just to be paranoid
                {
                    history.GetLast?.UpdateShipInformation(history.ShipInformationList.CurrentShip); // and make the last entry have this updated info.
                }
            }

            OnNewUIEvent?.Invoke(u);

            var t = BaseUtils.AppTicks.TickCountLapDelta("CTUI");

            if (t.Item2 > 25)
            {
                System.Diagnostics.Debug.WriteLine(t.Item1 + " Controller UI !!!");
            }
        }
            public void then_should_return_parent_ignored_given_parent_filter_status_is_ignored_enum_values(FilterStatus parentFilterStatus)
            {
                // Arrange
                var reader = new StatusReader(new Mock<IAntRegexGenerator>().Object);

                // Act
                var status = reader.GetFilterStatus("C:\\Temp", "*", parentFilterStatus, "C:\\Temp");

                // Assert
                Assert.That(status, Is.EqualTo(FilterStatus.ParentIgnored));
            }
            public void then_should_return_ignored_given_parent_filter_status_is_found_and_regex_does_not_matches()
            {
                // Arrange
                var antRegexGenerator = new Mock<IAntRegexGenerator>();
                antRegexGenerator.Setup(generator => generator.GetRegexForFilter("*")).Returns(new Regex("\\s"));
                var reader = new StatusReader(antRegexGenerator.Object);

                // Act
                var status = reader.GetFilterStatus("C:\\Temp\\MyProject", "*", FilterStatus.Found, "C:\\Temp");

                // Assert
                Assert.That(status, Is.EqualTo(FilterStatus.Ignored));
            }
Пример #5
0
        public void LoadStatusesFromFile(string path)
        {
            StatusReader reader = new StatusReader(Engine);
            JArray       json   = FileHandler.FromPath <JArray>(path);

            foreach (JToken entry in json)
            {
                if (entry.Type != JTokenType.Object)
                {
                    throw new MeException($"Expected a json object \"{path}\"at  \"{entry}\".");
                }

                StatusTemplate newEntry = reader.FromJSON(entry.ToObject <JObject>());
                AddStatus(newEntry);
            }
        }