Exemplo n.º 1
0
        public void TestParseStatusGuiFocus()
        {
            string line   = "{ \"timestamp\":\"2018-03-25T00:39:48Z\", \"event\":\"Status\", \"Flags\":16842765, \"Pips\":[5,2,5], \"FireGroup\":1, \"GuiFocus\":5 }";
            Status status = StatusMonitor.ParseStatusEntry(line);

            Assert.AreEqual(status.gui_focus, "station services");
        }
Exemplo n.º 2
0
        public bool Restart()
        {
            if (state.Pending)
            {
                return(false);
            }
            switch (state.Name)
            {
            case EmulationStateName.Finished:
                break;

            case EmulationStateName.InAction:
            case EmulationStateName.Paused:
                state.Change(EmulationStateName.PendedToRestart, false);
                if (state.Paused)
                {
                    Continue();
                }
                while (IsBusy)
                {
                    ;
                }
                break;

            default:
                return(false);
            }

            StatusMonitor = new StatusMonitor();
            state.Change(EmulationStateName.NotInitialized, false);
            Prepare(true);
            return(true);
        }
Exemplo n.º 3
0
        public void TestParseStatusFiregroup()
        {
            string line   = "{ \"timestamp\":\"2018-03-25T00:39:48Z\", \"event\":\"Status\", \"Flags\":16842765, \"Pips\":[5,2,5], \"FireGroup\":1, \"GuiFocus\":0 }";
            Status status = StatusMonitor.ParseStatusEntry(line);

            Assert.AreEqual(status.firegroup, 1);
        }
Exemplo n.º 4
0
        public void TestParseStatusFlagsDocked()
        {
            string line   = "{ \"timestamp\":\"2018-03-25T00:39:48Z\", \"event\":\"Status\", \"Flags\":16842765, \"Pips\":[5,2,5], \"FireGroup\":0, \"GuiFocus\":0 }";
            Status status = StatusMonitor.ParseStatusEntry(line);

            // Variables set from status flags (when not signed in, flags are set to '0')
            DateTime expectedTimestamp = new DateTime(2018, 3, 25, 0, 39, 48, DateTimeKind.Utc);

            Assert.AreEqual(expectedTimestamp, status.timestamp);
            Assert.AreEqual(status.flags, (Status.Flags) 16842765);
            Assert.AreEqual(status.vehicle, "Ship");
            Assert.IsFalse(status.being_interdicted);
            Assert.IsFalse(status.in_danger);
            Assert.IsFalse(status.near_surface);
            Assert.IsFalse(status.overheating);
            Assert.IsFalse(status.low_fuel);
            Assert.AreEqual(status.fsd_status, "masslock");
            Assert.IsFalse(status.srv_drive_assist);
            Assert.IsFalse(status.srv_under_ship);
            Assert.IsFalse(status.srv_turret_deployed);
            Assert.IsFalse(status.srv_handbrake_activated);
            Assert.IsFalse(status.scooping_fuel);
            Assert.IsFalse(status.silent_running);
            Assert.IsFalse(status.cargo_scoop_deployed);
            Assert.IsFalse(status.lights_on);
            Assert.IsFalse(status.in_wing);
            Assert.IsFalse(status.hardpoints_deployed);
            Assert.IsFalse(status.flight_assist_off);
            Assert.IsFalse(status.supercruise);
            Assert.IsTrue(status.shields_up);
            Assert.IsTrue(status.landing_gear_down);
            Assert.IsFalse(status.landed);
            Assert.IsTrue(status.docked);
        }
Exemplo n.º 5
0
        public void TestParseStatusFlagsSrv()
        {
            string line   = "{ \"timestamp\":\"2018-03-25T00:39:48Z\", \"event\":\"Status\", \"Flags\":69255432, \"Pips\":[2,8,2], \"FireGroup\":0, \"GuiFocus\":0, \"Latitude\":-5.683115, \"Longitude\":-10.957623, \"Heading\":249, \"Altitude\":0}";
            Status status = StatusMonitor.ParseStatusEntry(line);

            // Variables set from status flags (when not signed in, flags are set to '0')
            Assert.AreEqual(status.flags, (Status.Flags) 69255432);
            Assert.AreEqual(status.vehicle, "SRV");
            Assert.IsFalse(status.being_interdicted);
            Assert.IsFalse(status.in_danger);
            Assert.IsTrue(status.near_surface);
            Assert.IsFalse(status.overheating);
            Assert.IsFalse(status.low_fuel);
            Assert.AreEqual(status.fsd_status, "ready");
            Assert.IsTrue(status.srv_drive_assist);
            Assert.IsTrue(status.srv_under_ship);
            Assert.IsFalse(status.srv_turret_deployed);
            Assert.IsFalse(status.srv_handbrake_activated);
            Assert.IsFalse(status.scooping_fuel);
            Assert.IsFalse(status.silent_running);
            Assert.IsFalse(status.cargo_scoop_deployed);
            Assert.IsTrue(status.lights_on);
            Assert.IsFalse(status.in_wing);
            Assert.IsFalse(status.hardpoints_deployed);
            Assert.IsFalse(status.flight_assist_off);
            Assert.IsFalse(status.supercruise);
            Assert.IsTrue(status.shields_up);
            Assert.IsFalse(status.landing_gear_down);
            Assert.IsFalse(status.landed);
            Assert.IsFalse(status.docked);
        }
Exemplo n.º 6
0
        public void TestParseStatusFlagsAnalysisFssMode()
        {
            string line   = "{ \"timestamp\":\"2018 - 11 - 15T04: 41:06Z\", \"event\":\"Status\", \"Flags\":151519320, \"Pips\":[4,4,4], \"FireGroup\":2, \"GuiFocus\":9, \"Fuel\":30.404743, \"Cargo\":39.000000 }";
            Status status = StatusMonitor.ParseStatusEntry(line);

            Assert.AreEqual(true, status.analysis_mode);
            Assert.AreEqual("fss mode", status.gui_focus);
        }
Exemplo n.º 7
0
        public void TestParseStatusFlagsAnalysisSaaMode()
        {
            string line   = "{ \"timestamp\":\"2018 - 11 - 15T04: 47:51Z\", \"event\":\"Status\", \"Flags\":150995032, \"Pips\":[4,4,4], \"FireGroup\":2, \"GuiFocus\":10, \"Fuel\":30.074390, \"Cargo\":39.000000 }";
            Status status = StatusMonitor.ParseStatusEntry(line);

            Assert.AreEqual(true, status.analysis_mode);
            Assert.AreEqual("saa mode", status.gui_focus);
        }
Exemplo n.º 8
0
        public void TestParseStatusPips()
        {
            string line   = "{ \"timestamp\":\"2018-03-25T00:39:48Z\", \"event\":\"Status\", \"Flags\":16842765, \"Pips\":[5,2,5], \"FireGroup\":0, \"GuiFocus\":0 }";
            Status status = StatusMonitor.ParseStatusEntry(line);

            Assert.AreEqual(status.pips_sys, (decimal)2.5);
            Assert.AreEqual(status.pips_eng, (decimal)1);
            Assert.AreEqual(status.pips_wea, (decimal)2.5);
        }
Exemplo n.º 9
0
        public void TestParseStatusFlagsSupercruise()
        {
            string line   = "{ \"timestamp\":\"2018-03-25T00:39:48Z\", \"event\":\"Status\", \"Flags\":16777240, \"Pips\":[7,1,4], \"FireGroup\":0, \"GuiFocus\":0 }";
            Status status = StatusMonitor.ParseStatusEntry(line);

            // Variables set from status flags (when not signed in, flags are set to '0')
            Assert.AreEqual(status.flags, (Status.Flags) 16777240);
            Assert.AreEqual(status.vehicle, "Ship");
            Assert.IsTrue(status.supercruise);
        }
Exemplo n.º 10
0
        public void TestParseStatusGps2()
        {
            string line   = "{ \"timestamp\":\"2018-03-25T00:39:48Z\", \"event\":\"Status\", \"Flags\":69255432, \"Pips\":[2,8,2], \"FireGroup\":0, \"GuiFocus\":0, \"Latitude\":-5.683115, \"Longitude\":-10.957623, \"Heading\":249, \"Altitude\":0}";
            Status status = StatusMonitor.ParseStatusEntry(line);

            Assert.AreEqual(status.latitude, (decimal) - 5.683115);
            Assert.AreEqual(status.longitude, (decimal) - 10.957623);
            Assert.AreEqual(status.altitude, (decimal)0);
            Assert.AreEqual(status.heading, (decimal)249);
        }
Exemplo n.º 11
0
        public void TestParseStatusGps1()
        {
            string line   = "{ \"timestamp\":\"2018-03-25T00:39:48Z\", \"event\":\"Status\", \"Flags\":16842765, \"Pips\":[5,2,5], \"FireGroup\":1, \"GuiFocus\":0 }";
            Status status = StatusMonitor.ParseStatusEntry(line);

            Assert.IsNull(status.latitude);
            Assert.IsNull(status.longitude);
            Assert.IsNull(status.altitude);
            Assert.IsNull(status.heading);
        }
Exemplo n.º 12
0
        public void TestParseStatusFlagsNightMode()
        {
            string line   = "{ \"timestamp\":\"2018 - 11 - 15T04: 58:37Z\", \"event\":\"Status\", \"Flags\":422117640, \"Pips\":[4,4,4], \"FireGroup\":2, \"GuiFocus\":0, \"Fuel\":29.564209, \"Cargo\":39.000000, \"Latitude\":88.365417, \"Longitude\":99.356514, \"Heading\":29, \"Altitude\":36 }";
            Status status = StatusMonitor.ParseStatusEntry(line);

            Assert.AreEqual(true, status.night_vision);
            Assert.AreEqual(true, status.lights_on);
            Assert.AreEqual("none", status.gui_focus);
            Assert.AreEqual(29.564209M, status.fuel);
            Assert.AreEqual(39, status.cargo_carried);
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            var settings = new StatusMonitorSettings
            {
                ApiUsername = ConfigurationManager.AppSettings["ApiUsername"].ToString(),
                ApiPassword = ConfigurationManager.AppSettings["ApiPassword"].ToString(),
                CertificateExpirationDays = Convert.ToInt32(ConfigurationManager.AppSettings["CertificateExpirationDays"])
            };

            var statusMonitor = new StatusMonitor(settings);

            statusMonitor.RunChecks();

            Console.WriteLine("Press a key to exit");
            Console.ReadKey();
        }
Exemplo n.º 14
0
 public Emulation(IWorldMapProvider mapProvider,
                  IWorldMapFiller mapFiller,
                  IGenerationBuilder generationBuilder,
                  EmulationConfig config)
 {
     StatusMonitor                     = new StatusMonitor();
     state                             = new EmulationState();
     state.Changed                    += state => StateChanged?.Invoke(state);
     this.mapProvider                  = mapProvider;
     this.mapFiller                    = mapFiller;
     this.generationBuilder            = generationBuilder;
     Config                            = config;
     iterationsCountSinceLastItemSpawn = new Dictionary <WorldObjectType, int>
     {
         { WorldObjectType.Food, 0 },
         { WorldObjectType.Poison, 0 },
     };
 }
Exemplo n.º 15
0
        public void Handle(Event @event)
        {
            if (@event.fromLoad)
            {
                return;
            }

            Logging.Debug("Received event " + JsonConvert.SerializeObject(@event));
            StatusMonitor statusMonitor = (StatusMonitor)EDDI.Instance.ObtainMonitor("Status monitor");

            if (@event is BodyScannedEvent bodyScannedEvent)
            {
                if (bodyScannedEvent.scantype.Contains("NavBeacon"))
                {
                    // Suppress scan details from nav beacons
                    return;
                }
            }
            else if (@event is StarScannedEvent starScannedEvent)
            {
                if (starScannedEvent.scantype.Contains("NavBeacon"))
                {
                    // Suppress scan details from nav beacons
                    return;
                }
                else if (EDDI.Instance.CurrentStarSystem?.bodies?
                         .FirstOrDefault(s => s.bodyname == starScannedEvent.bodyname)?
                         .scanned < starScannedEvent.timestamp)
                {
                    // Suppress voicing new scans after the first scan occurrence
                    return;
                }
            }
            else if (@event is CommunityGoalEvent)
            {
                // Disable speech from the community goal event for the time being.
                return;
            }

            Say(@event);
        }
Exemplo n.º 16
0
        public static void Main(string[] args)
        {
            LW.SetLogLevel(LogLevel.Dbg);
            LW.InitLog();
            StartUpTime = DateTime.Now;
            LW.D("WoodenBench WebServer Starting....");
            LW.D($"\t Startup Time {StartUpTime.ToString()}.");
            Version = new FileInfo(new string(Assembly.GetExecutingAssembly().CodeBase.Skip(8).ToArray())).LastWriteTime.ToString();
            LW.D($"\t Version {Version}");

            var v = XConfig.LoadAll();

            if (!(v.Item1 && v.Item2))
            {
                return;
            }

            StatusMonitor.StartMonitorThread();
            WeChatHelper.ReNewWCCodes();

            DataBaseOperation.InitialiseClient();
            //DataBaseOperation.InitialiseClient(IPAddress.Loopback);

            WeChatHelper.InitialiseExcryptor();

            LW.D("Initialising Core Messaging Systems.....");
            WeChatMessageSystem.StartProcessThreads();
            WeChatMessageBackupService.StartBackupThread();
            MessagingSystem.StartProcessThread();

            var webHost = BuildWebHost(XConfig.Current.ApplicationInsightInstrumentationKey, args);

            LW.D("Starting WebHost....");

            WebServerTask = webHost.RunAsync(ServerStopToken.Token);
            WebServerTask.Wait();
            LW.E("WebServer Stoped! Cancellation Token = " + ServerStopToken.IsCancellationRequested);
        }
Exemplo n.º 17
0
        public static void VA_Init1(dynamic vaProxy)
        {
            Logging.Info("Initialising EDDI VoiceAttack plugin");
            EDDI.FromVA = true;

            try
            {
                GetEddiInstance(ref vaProxy);
                Logging.incrementLogs();
                App.StartRollbar();
                App.ApplyAnyOverrideCulture();
                EDDI.Instance.Start();

                // Set up our event responder
                VoiceAttackResponder.RaiseEvent += (s, theEvent) =>
                {
                    try
                    {
                        eventQueue.Enqueue(theEvent);
                        Thread eventHandler = new Thread(() => dequeueEvent(ref vaProxy))
                        {
                            Name         = "VoiceAttackEventHandler",
                            IsBackground = true
                        };
                        eventHandler.Start();
                        eventHandler.Join();
                    }
                    catch (ThreadAbortException tax)
                    {
                        Thread.ResetAbort();
                        Logging.Debug("Thread aborted", tax);
                    }
                    catch (Exception ex)
                    {
                        Dictionary <string, object> data = new Dictionary <string, object>
                        {
                            { "event", JsonConvert.SerializeObject(theEvent) },
                            { "exception", ex.Message },
                            { "stacktrace", ex.StackTrace }
                        };
                        Logging.Error("VoiceAttack failed to handle event.", data);
                    }
                };

                // Add notifiers for changes in variables we want to react to
                // (we can only use event handlers with classes which are always constructed - nullable objects will be updated via responder events)
                EDDI.Instance.State.CollectionChanged  += (s, e) => setDictionaryValues(EDDI.Instance.State, "state", ref vaProxy);
                SpeechService.Instance.PropertyChanged += (s, e) => setSpeaking(SpeechService.Instance.eddiSpeaking, ref vaProxy);

                CargoMonitor cargoMonitor = (CargoMonitor)EDDI.Instance.ObtainMonitor("Cargo monitor");
                cargoMonitor.InventoryUpdatedEvent += (s, e) =>
                {
                    lock (vaProxyLock)
                    {
                        setCargo(cargoMonitor, ref vaProxy);
                    }
                };

                ShipMonitor shipMonitor = (ShipMonitor)EDDI.Instance.ObtainMonitor("Ship monitor");
                shipMonitor.ShipyardUpdatedEvent += (s, e) =>
                {
                    lock (vaProxyLock)
                    {
                        setShipValues(shipMonitor?.GetCurrentShip(), "Ship", ref vaProxy);
                        Task.Run(() => setShipyardValues(shipMonitor?.shipyard?.ToList(), ref vaProxy));
                    }
                };

                StatusMonitor statusMonitor = (StatusMonitor)EDDI.Instance.ObtainMonitor("Status monitor");
                statusMonitor.StatusUpdatedEvent += (s, e) =>
                {
                    lock (vaProxyLock)
                    {
                        setStatusValues(statusMonitor?.currentStatus, "Status", ref vaProxy);
                    }
                };

                // Display instance information if available
                if (EDDI.Instance.UpgradeRequired)
                {
                    vaProxy.WriteToLog("Please shut down VoiceAttack and run EDDI standalone to upgrade", "red");
                    string msg = Properties.VoiceAttack.run_eddi_standalone;
                    SpeechService.Instance.Say(((ShipMonitor)EDDI.Instance.ObtainMonitor("Ship monitor")).GetCurrentShip(), msg, 0);
                }
                else if (EDDI.Instance.UpgradeAvailable)
                {
                    vaProxy.WriteToLog("Please shut down VoiceAttack and run EDDI standalone to upgrade", "orange");
                    string msg = Properties.VoiceAttack.run_eddi_standalone;
                    SpeechService.Instance.Say(((ShipMonitor)EDDI.Instance.ObtainMonitor("Ship monitor")).GetCurrentShip(), msg, 0);
                }

                if (EDDI.Instance.Motd != null)
                {
                    vaProxy.WriteToLog("Message from EDDI: " + EDDI.Instance.Motd, "black");
                    string msg = String.Format(Eddi.Properties.EddiResources.msg_from_eddi, EDDI.Instance.Motd);
                    SpeechService.Instance.Say(((ShipMonitor)EDDI.Instance.ObtainMonitor("Ship monitor")).GetCurrentShip(), msg, 0);
                }

                // Set the initial values from the main EDDI objects
                setStandardValues(ref vaProxy);

                vaProxy.WriteToLog("The EDDI plugin is fully operational.", "green");
                setStatus(ref vaProxy, "Operational");

                // Fire an event once the VA plugin is initialized
                Event @event = new VAInitializedEvent(DateTime.UtcNow);

                if (initEventEnabled(@event.type))
                {
                    EDDI.Instance.enqueueEvent(@event);
                }

                // Set a variable indicating the version of VoiceAttack in use
                System.Version v = vaProxy.VAVersion;
                EDDI.Instance.vaVersion = v.ToString();

                // Set a variable indicating whether EDDI is speaking
                try
                {
                    setSpeaking(SpeechService.Instance.eddiSpeaking, ref vaProxy);
                }
                catch (Exception ex)
                {
                    Logging.Error("Failed to set initial speaking status", ex);
                }
                Logging.Info("EDDI VoiceAttack plugin initialization complete");
            }
            catch (Exception e)
            {
                Logging.Error("Failed to initialize VoiceAttack plugin", e);
                vaProxy.WriteToLog("Unable to fully initialize EDDI. Some functions may not work.", "red");
            }
        }
Exemplo n.º 18
0
        private void StatusMonitorConfigDisplay(uint statusId, float maxDuration, string note = null, bool raid = false, bool selfOnly = false, uint[] statusList = null, string forcedName = null, ushort limitedZone = 0, bool stacking = false)
        {
            var status = pluginInterface.Data.GetExcelSheet <Status>().GetRow(statusId);

            if (status == null)
            {
                return;
            }
            var statusMonitor = new StatusMonitor {
                Status = status.RowId, ClassJob = pluginInterface.ClientState.LocalPlayer.ClassJob.Id, MaxDuration = maxDuration, SelfOnly = selfOnly, StatusList = statusList, IsRaid = raid, LimitedZone = limitedZone, Stacking = stacking
            };

            var statusIcon = plugin.IconManager.GetIconTexture(status.Icon);

            if (statusIcon != null)
            {
                ImGui.Image(statusIcon.ImGuiHandle, new Vector2(18, 24));
            }
            else
            {
                ImGui.Dummy(new Vector2(18, 24));
            }

            if (ImGui.IsItemHovered())
            {
                ImGui.SetTooltip(status.Description);
            }

            if (statusList != null)
            {
                foreach (var s in statusList)
                {
                    ImGui.SameLine();
                    ImGui.SetCursorPosX(ImGui.GetCursorPosX() - 10);
                    var extraStatus = pluginInterface.Data.GetExcelSheet <Status>().GetRow(s);
                    if (extraStatus == null)
                    {
                        continue;
                    }
                    var extraStatusIcon = plugin.IconManager.GetIconTexture(extraStatus.Icon);
                    if (extraStatusIcon == null)
                    {
                        continue;
                    }
                    ImGui.Image(extraStatusIcon.ImGuiHandle, new Vector2(18, 24));
                    if (ImGui.IsItemHovered())
                    {
                        ImGui.SetTooltip(extraStatus.Description);
                    }
                }
            }

            ImGui.SameLine();

            ImGui.Text(forcedName ?? status.Name);

            if (!string.IsNullOrEmpty(note))
            {
                ImGui.SameLine();
                ImGui.Text($"({note})");
            }

            if (selfOnly)
            {
                var selfTextSize = ImGui.CalcTextSize("[SELF]");
                ImGui.SameLine();
                ImGui.SetCursorPosX(ImGui.GetColumnWidth() - selfTextSize.X);
                ImGui.TextDisabled("[SELF]");
            }


            ImGui.NextColumn();

            foreach (var s in MonitorDisplays.Values.Where(d => d.Enabled))
            {
                var enabled = s.StatusMonitors.Contains(statusMonitor);
                if (ImGui.Checkbox($"###statusToggle{s.Guid}_{status.RowId}", ref enabled))
                {
                    if (enabled)
                    {
                        s.StatusMonitors.Add(statusMonitor);
                    }
                    else
                    {
                        s.StatusMonitors.Remove(statusMonitor);
                    }
                    Save();
                }
                ImGui.NextColumn();
            }

            ImGui.Separator();
        }
Exemplo n.º 19
0
        public static void VA_Init1(dynamic vaProxy)
        {
            // Initialize and launch an EDDI instance without opening the main window
            // VoiceAttack commands will be used to manipulate the window state.
            App.vaProxy = vaProxy;
            if (App.AlreadyRunning())
            {
                return;
            }

            Thread appThread = new Thread(App.Main);

            appThread.SetApartmentState(ApartmentState.STA);
            appThread.Start();

            try
            {
                int timeout = 0;
                while (Application.Current == null)
                {
                    if (timeout < 200)
                    {
                        Thread.Sleep(50);
                        timeout++;
                    }
                    else
                    {
                        throw new TimeoutException("EDDI VoiceAttack plugin initialisation has timed out");
                    }
                }

                Logging.Info("Initialising EDDI VoiceAttack plugin");

                // Set up our event responder.
                VoiceAttackResponder.RaiseEvent += (s, theEvent) =>
                {
                    if (theEvent is null)
                    {
                        return;
                    }
                    if (eventQueues.ContainsKey(theEvent.type))
                    {
                        // Add our event to an existing blocking collection for that event type.
                        eventQueues[theEvent.type].Add(theEvent);
                    }
                    else
                    {
                        // Add our event to a new blocking collection for that event type and start a consumer task for that collection
                        eventQueues[theEvent.type] = new BlockingCollection <Event> {
                            theEvent
                        };
                        var consumerTask = Task.Run(() =>
                        {
                            // ReSharper disable once AccessToModifiedClosure - OK to use vaProxy in this context.
                            dequeueEvents(eventQueues[theEvent.type], ref vaProxy);
                        });
                        consumerTasks.Add(consumerTask);
                    }
                };

                // Add notifiers for changes in variables we want to react to
                // (we can only use event handlers with classes which are always constructed - nullable objects will be updated via responder events)
                EDDI.Instance.PropertyChanged             += (s, e) => updateStandardValues(e);
                EDDI.Instance.State.CollectionChanged     += (s, e) => setDictionaryValues(EDDI.Instance.State, "state", ref vaProxy);
                SpeechService.Instance.PropertyChanged    += (s, e) => setSpeechState(e);
                CompanionAppService.Instance.StateChanged += (oldState, newState) => setCAPIState(newState == CompanionAppService.State.Authorized, ref vaProxy);

                CargoMonitor cargoMonitor = (CargoMonitor)EDDI.Instance.ObtainMonitor("Cargo monitor");
                cargoMonitor.InventoryUpdatedEvent += (s, e) =>
                {
                    lock (vaProxyLock)
                    {
                        setCargo(cargoMonitor, ref vaProxy);
                    }
                };

                ShipMonitor shipMonitor = (ShipMonitor)EDDI.Instance.ObtainMonitor("Ship monitor");
                if (shipMonitor != null)
                {
                    shipMonitor.ShipyardUpdatedEvent += (s, e) =>
                    {
                        lock (vaProxyLock)
                        {
                            setShipValues(shipMonitor.GetCurrentShip(), "Ship", ref vaProxy);
                            Task.Run(() => setShipyardValues(shipMonitor.shipyard?.Copy().ToList(), ref vaProxy));
                        }
                    };
                }

                StatusMonitor statusMonitor = (StatusMonitor)EDDI.Instance.ObtainMonitor("Status monitor");
                if (statusMonitor != null)
                {
                    statusMonitor.StatusUpdatedEvent += (s, e) =>
                    {
                        lock (vaProxyLock)
                        {
                            setStatusValues(statusMonitor.currentStatus, "Status", ref vaProxy);
                        }
                    };
                }

                // Set initial values for standard variables
                initializeStandardValues();

                // Display instance information if available
                if (EddiUpgrader.UpgradeRequired)
                {
                    vaProxy.WriteToLog("Please shut down VoiceAttack and run EDDI standalone to upgrade", "red");
                    string msg = Properties.VoiceAttack.run_eddi_standalone;
                    SpeechService.Instance.Say(null, msg, 0);
                }
                else if (EddiUpgrader.UpgradeAvailable)
                {
                    vaProxy.WriteToLog("Please shut down VoiceAttack and run EDDI standalone to upgrade", "orange");
                    string msg = Properties.VoiceAttack.run_eddi_standalone;
                    SpeechService.Instance.Say(null, msg, 0);
                }

                if (EddiUpgrader.Motd != null)
                {
                    vaProxy.WriteToLog("Message from EDDI: " + EddiUpgrader.Motd, "black");
                    string msg = String.Format(Eddi.Properties.EddiResources.msg_from_eddi, EddiUpgrader.Motd);
                    SpeechService.Instance.Say(null, msg, 0);
                }

                vaProxy.WriteToLog("The EDDI plugin is fully operational.", "green");
                setStatus(ref vaProxy, "Operational");

                // Fire an event once the VA plugin is initialized
                EDDI.Instance.enqueueEvent(new VAInitializedEvent(DateTime.UtcNow));

                // Set a variable indicating the version of VoiceAttack in use
                System.Version v = vaProxy.VAVersion;
                EDDI.Instance.vaVersion = v.ToString();

                Logging.Info("EDDI VoiceAttack plugin initialization complete");
            }
            catch (Exception e)
            {
                Logging.Error("Failed to initialize VoiceAttack plugin", e);
                vaProxy.WriteToLog("Unable to fully initialize EDDI. Some functions may not work.", "red");
            }
        }
Exemplo n.º 20
0
 internal void NotifyChanges(IDictionary <string, SvnClientAction> actions)
 {
     StatusMonitor.HandleSvnResult(actions);
 }
 public EmulationStatusMonitor(StatusMonitor monitor)
 {
     this.monitor = monitor;
     InitializeComponent();
 }
 private async void UpdateStatus(Object sender, RoutedEventArgs e)
 {
     Root.DataContext = await StatusMonitor.GetCurrentStatus();
 }
Exemplo n.º 23
0
        public void Handle(Event @event)
        {
            if (@event.fromLoad)
            {
                return;
            }

            Logging.Debug("Received event " + JsonConvert.SerializeObject(@event));
            StatusMonitor statusMonitor = (StatusMonitor)EDDI.Instance.ObtainMonitor("Status monitor");

            if (@event is BeltScannedEvent)
            {
                // We ignore belt clusters
                return;
            }
            else if (@event is BodyMappedEvent)
            {
                ignoreBodyScan = true;
            }
            else if (@event is BodyScannedEvent bodyScannedEvent)
            {
                if (bodyScannedEvent.scantype.Contains("NavBeacon") || bodyScannedEvent.scantype == "AutoScan")
                {
                    // Suppress scan details from nav beacons and `AutoScan` events.
                    return;
                }
                else if (ignoreBodyScan)
                {
                    // Suppress surface mapping probes from voicing redundant body scan events.
                    ignoreBodyScan = false;
                    return;
                }
            }
            else if (@event is StarScannedEvent starScannedEvent)
            {
                if (starScannedEvent.scantype.Contains("NavBeacon"))
                {
                    // Suppress scan details from nav beacons
                    return;
                }
                else if (enqueueStarScan)
                {
                    AddToEventQueue(@event);
                    return;
                }
            }
            else if (@event is JumpedEvent)
            {
                TakeTypeFromEventQueue <StarScannedEvent>();
                enqueueStarScan = true;
            }
            else if (@event is CommunityGoalEvent)
            {
                // Disable speech from the community goal event for the time being.
                return;
            }
            else if (@event is SignalDetectedEvent)
            {
                if (!(statusMonitor?.currentStatus.gui_focus == "fss mode" || statusMonitor?.currentStatus.gui_focus == "saa mode"))
                {
                    return;
                }
            }

            if (statusMonitor?.currentStatus.gui_focus == "fss mode" && statusMonitor?.lastStatus.gui_focus != "fss mode")
            {
                // Beginning with Elite Dangerous v. 3.3, the primary star scan is delivered via a Scan with
                // scantype `AutoScan` when you jump into the system. Secondary stars may be delivered in a burst
                // following an FSSDiscoveryScan. Since each source has a different trigger, we re-order events
                // and and report queued star scans when the pilot enters fss mode
                Say(@event);
                enqueueStarScan = false;
                foreach (Event theEvent in TakeTypeFromEventQueue <StarScannedEvent>()?.OrderBy(s => ((StarScannedEvent)s)?.distance))
                {
                    Say(theEvent);
                }
                return;
            }

            Say(@event);
        }
Exemplo n.º 24
0
 public App()
 {
     StatusMonitor.Start();
 }