Beispiel #1
0
            public FSSSignal(JObject evt, System.DateTime EventTimeUTC)
            {
                SignalName           = evt["SignalName"].Str();
                SignalName_Localised = JournalFieldNaming.CheckLocalisation(evt["SignalName_Localised"].Str(), SignalName);

                SpawingState           = evt["SpawingState"].Str();
                SpawingState_Localised = JournalFieldNaming.CheckLocalisation(evt["SpawingState_Localised"].Str(), SpawingState);

                SpawingFaction           = evt["SpawingFaction"].Str();
                SpawingFaction_Localised = JournalFieldNaming.CheckLocalisation(evt["SpawingFaction_Localised"].Str(), SpawingFaction);

                TimeRemaining = evt["TimeRemaining"].DoubleNull();

                SystemAddress = evt["SystemAddress"].LongNull();

                ThreatLevel      = evt["USSThreat"].IntNull();
                USSType          = evt["USSType"].Str();
                USSTypeLocalised = JournalFieldNaming.CheckLocalisation(evt["USSType_Localised"].Str(), USSType);
                IsStation        = evt["IsStation"].BoolNull();

                if (TimeRemaining != null)
                {
                    ExpiryUTC   = EventTimeUTC.AddSeconds(TimeRemaining.Value);
                    ExpiryLocal = ExpiryUTC.ToLocalTime();
                }
            }
            const int CarrierExpiryTime = 10 * (60 * 60 * 24);              // days till we consider the carrier signal expired..

            public FSSSignal(JObject evt, System.DateTime EventTimeUTC)
            {
                SignalName = evt["SignalName"].Str();
                string loc = evt["SignalName_Localised"].Str();       // not present for stations/installations

                SignalName_Localised = loc.Alt(SignalName);           // don't mangle if no localisation, its prob not there because its a proper name

                SpawningState           = evt["SpawningState"].Str(); // USS only, checked
                SpawningState_Localised = JournalFieldNaming.CheckLocalisation(evt["SpawningState_Localised"].Str(), SpawningState);

                SpawningFaction           = evt["SpawningFaction"].Str(); // USS only, checked
                SpawningFaction_Localised = JournalFieldNaming.CheckLocalisation(evt["SpawningFaction_Localised"].Str(), SpawningFaction);

                USSType          = evt["USSType"].Str();            // USS Only, checked
                USSTypeLocalised = JournalFieldNaming.CheckLocalisation(evt["USSType_Localised"].Str(), USSType);

                ThreatLevel = evt["ThreatLevel"].IntNull();         // USS only, checked

                TimeRemaining = evt["TimeRemaining"].DoubleNull();  // USS only, checked

                SystemAddress = evt["SystemAddress"].LongNull();

                bool?isstation = evt["IsStation"].BoolNull();

                if (isstation == true)          // station flag
                {
                    int dash = SignalName.LastIndexOf('-');
                    if (SignalName.Length >= 5 && dash == SignalName.Length - 4 && char.IsLetterOrDigit(SignalName[dash + 1]) && char.IsLetterOrDigit(SignalName[dash - 1]))
                    {
                        ClassOfSignal = Classification.Carrier;
                        TimeRemaining = CarrierExpiryTime;
                    }
                    else
                    {
                        ClassOfSignal = Classification.Station;
                    }
                }
                else if (loc.Length == 0)       // other types, and old station entries, don't have localisation, so its an installation
                {
                    ClassOfSignal = Classification.Installation;
                }
                else if (SignalName.StartsWith("$USS", StringComparison.InvariantCultureIgnoreCase) || SignalName.StartsWith("$RANDOM", StringComparison.InvariantCultureIgnoreCase))
                {
                    ClassOfSignal = Classification.USS;
                }
                else if (SignalName.StartsWith("$Warzone", StringComparison.InvariantCultureIgnoreCase))
                {
                    ClassOfSignal = Classification.ConflictZone;
                }
                else if (SignalName.StartsWith("$Fixed_Event_Life", StringComparison.InvariantCultureIgnoreCase))
                {
                    ClassOfSignal = Classification.NotableStellarPhenomena;
                }
                else if (SignalName.StartsWith("$MULTIPLAYER_SCENARIO14", StringComparison.InvariantCultureIgnoreCase) || SignalName.StartsWith("$MULTIPLAYER_SCENARIO7", StringComparison.InvariantCultureIgnoreCase))
                {
                    ClassOfSignal = Classification.ResourceExtraction;
                }
                else
                {
                    ClassOfSignal = Classification.Other;
                }

                RecordedUTC = EventTimeUTC;

                if (TimeRemaining != null)
                {
                    ExpiryUTC   = EventTimeUTC.AddSeconds(TimeRemaining.Value);
                    ExpiryLocal = ExpiryUTC.ToLocalTime();
                }
            }