private IEnumerable <EddnEvent> ConvertOutfittingEvent(Outfitting e, string commanderName)
        {
            if (e.Items == null || e.Items.Length == 0)
            {
                yield break;
            }

            string[] items = e.Items
                             .Select(i => i.Name)
                             .Select(i => i.Replace("hpt_", "Hpt_").Replace("int_", "Int_").Replace("armour_", "Armour_"))
                             .ToArray();

            var @event = new OutfittingEvent()
            {
                Header  = CreateHeader(commanderName),
                Message = new OutfittingMessage()
                {
                    MarketId    = e.MarketId,
                    Timestamp   = e.Timestamp,
                    StationName = e.StationName,
                    SystemName  = e.StarSystem,
                    Modules     = items
                }
            };

            yield return(@event);
        }
Exemple #2
0
 internal OutfittingEvent InvokeEvent(OutfittingEvent arg)
 {
     if (_api.ValidateEvent(arg))
     {
         Outfitting?.Invoke(_api, arg);
     }
     return(arg);
 }
 private static void AssertEvent(OutfittingEvent @event)
 {
     Assert.NotNull(@event);
     Assert.Equal(DateTime.Parse("2019-09-09T12:04:57Z"), @event.Timestamp);
     Assert.Equal(EventName, @event.Event);
     Assert.Equal(128675975, @event.MarketId);
     Assert.Equal("Demolition Unlimited", @event.StationName);
     Assert.Equal("Eurybia", @event.StarSystem);
 }
        private static void AssertFileEvent(OutfittingEvent @event)
        {
            Assert.NotNull(@event);
            Assert.Equal(DateTime.Parse("2019-09-08T10:23:48Z"), @event.Timestamp);
            Assert.Equal(EventName, @event.Event);
            Assert.Equal(3223641856, @event.MarketId);
            Assert.Equal("Nagel City", @event.StationName);
            Assert.Equal("Scylla", @event.StarSystem);
            Assert.True(@event.Horizons);
            Assert.Equal(259, @event.Items.Length);

            Assert.Equal(128049445, @event.Items[0].Id);
            Assert.Equal("hpt_cannon_turret_small", @event.Items[0].Name);
            Assert.Equal(506400, @event.Items[0].BuyPrice);

            Assert.Equal(128064085, @event.Items[258].Id);
            Assert.Equal("int_engine_size5_class3", @event.Items[258].Name);
            Assert.Equal(567106, @event.Items[258].BuyPrice);
        }
 internal void InvokeOutfittingEvent(OutfittingEvent arg)
 {
     OutfittingEvent?.Invoke(this, arg);
 }
Exemple #6
0
 internal void InvokeOutfittingEvent(OutfittingEvent arg) => OutfittingEvent?.Invoke(null, arg);