コード例 #1
0
ファイル: EsiJobListItem.cs プロジェクト: th-eve/evemon
 public SerializableJobListItem ToXMLItem()
 {
     return(new SerializableJobListItem()
     {
         ActivityID = ActivityID,
         BlueprintID = BlueprintID,
         BlueprintLocationID = BlueprintLocationID,
         BlueprintTypeID = BlueprintTypeID,
         BlueprintTypeName = StaticItems.GetItemName(BlueprintTypeID),
         CompletedCharacterID = CompletedCharacterID,
         CompletedDate = CompletedDate,
         Cost = Cost,
         EndDate = EndDate,
         FacilityID = FacilityID,
         InstallerID = InstallerID,
         JobID = JobID,
         LicensedRuns = LicensedRuns,
         OutputLocationID = OutputLocationID,
         PauseDate = PauseDate,
         Probability = Probability,
         ProductTypeID = ProductTypeID,
         ProductTypeName = StaticItems.GetItemName(ProductTypeID),
         Runs = Runs,
         StartDate = StartDate,
         StationID = BlueprintLocationID,
         Status = (int)Status,
         SuccessfulRuns = SuccessfulRuns,
         TimeInSeconds = TimeInSeconds
     });
 }
コード例 #2
0
        public SerializablePlanetaryColony ToXMLItem()
        {
            // Determine planet type from type name
            // Planet type is a type ID
            CCPAPIPlanetTypes type = CCPAPIPlanetTypes.Unknown;

            if (!string.IsNullOrEmpty(PlanetType))
            {
                Enum.TryParse(PlanetType, true, out type);
            }
            int planetType = (int)type;

            var ret = new SerializablePlanetaryColony()
            {
                LastUpdate      = LastUpdate,
                NumberOfPins    = NumberOfPins,
                OwnerID         = OwnerID,
                PlanetID        = PlanetID,
                SolarSystemID   = SolarSystemID,
                SolarSystemName = StaticGeography.GetSolarSystemName(SolarSystemID),
                PlanetTypeID    = planetType,
                PlanetTypeName  = StaticItems.GetItemName(planetType),
                UpgradeLevel    = UpgradeLevel
            };

            return(ret);
        }
コード例 #3
0
        /// <summary>
        /// Imports data from an ESI deserialization object.
        /// </summary>
        public void Import(EsiAPIClones serial)
        {
            if (serial == null)
            {
                return;
            }

            m_cloneSets.Clear();
            // Jump clones
            foreach (var clone in serial.JumpClones)
            {
                int cloneID = clone.JumpCloneID;
                var set     = new ImplantSet(m_character, GetCloneName(clone.Name, clone.
                                                                       LocationID));
                // Jump clone implants
                var jcImplants = new LinkedList <SerializableNewImplant>();
                foreach (int implant in clone.Implants)
                {
                    jcImplants.AddLast(new SerializableNewImplant()
                    {
                        ID   = implant,
                        Name = StaticItems.GetItemName(implant)
                    });
                }
                set.Import(jcImplants);
                m_cloneSets.Add(set);
            }

            EveMonClient.OnCharacterImplantSetCollectionChanged(m_character);
        }
コード例 #4
0
        /// <summary>
        /// Parses the item list from a delivery. The format is an array of 2-element arrays,
        /// where element 0 is the quantity and element 1 is the type ID.
        /// </summary>
        /// <param name="typeIDs">The type IDs and quantities of delivered items</param>
        /// <returns></returns>
        private static string BuildItemList(YamlSequenceNode typeIDs)
        {
            string items;

            if (!typeIDs.Any())
            {
                items = "No items were delivered";
            }
            else
            {
                int type, qty;
                var sb = new StringBuilder(512);
                // Add all valid types to the string
                foreach (var typeAndQty in typeIDs)
                {
                    // Convert to array, proceed only if successful and has 2 elements
                    var array = (typeAndQty as YamlSequenceNode)?.Children;
                    if (array?.Count == 2 && array[0].ToString().TryParseInv(out qty) &&
                        qty > 0 && array[1].ToString().TryParseInv(out type) && type > 0)
                    {
                        sb.AppendLine(string.Format("{0}x {1}", qty.ToNumericString(0),
                                                    StaticItems.GetItemName(type)));
                    }
                }
                items = sb.ToString();
            }
            return(items);
        }
コード例 #5
0
ファイル: Character.cs プロジェクト: Slazanger/evemon
        /// <summary>
        /// Imports data from the given character ship information.
        /// </summary>
        /// <param name="result">The serialized character ship information</param>
        internal void Import(EsiResult <EsiAPIShip> result)
        {
            var ship = result.Result;

            ShipName     = ship.ShipName;
            ShipTypeName = StaticItems.GetItemName(ship.ShipTypeID);
            EveMonClient.OnCharacterInfoUpdated(this);
        }
コード例 #6
0
ファイル: Character.cs プロジェクト: kinseytamsin/evemon
        /// <summary>
        /// Imports data from the given implants information.
        /// </summary>
        /// <param name="implants">The serialized implant information</param>
        internal void Import(List <int> implants)
        {
            // Implants
            var newImplants = new LinkedList <SerializableNewImplant>();

            foreach (int implant in implants)
            {
                newImplants.AddLast(new SerializableNewImplant()
                {
                    ID   = implant,
                    Name = StaticItems.GetItemName(implant)
                });
            }
            CurrentImplants.Import(newImplants);
        }
コード例 #7
0
ファイル: Character.cs プロジェクト: th-eve/evemon
        /// <summary>
        /// Imports data from the given implants information.
        /// </summary>
        /// <param name="implants">The serialized implant information</param>
        internal void Import(List <int> implants)
        {
            // Implants
            var newImplants = new LinkedList <SerializableNewImplant>();

            foreach (int implant in implants)
            {
                newImplants.AddLast(new SerializableNewImplant()
                {
                    ID   = implant,
                    Name = StaticItems.GetItemName(implant)
                });
            }
            CurrentImplants.Import(newImplants);
            EveMonClient.OnCharacterImplantSetCollectionChanged(this);
        }
コード例 #8
0
ファイル: PlanetaryColony.cs プロジェクト: wbSD/evemon
        /// <summary>
        /// Initializes a new instance of the <see cref="PlanetaryColony"/> class.
        /// </summary>
        /// <param name="ccpCharacter">The CCP character.</param>
        /// <param name="src">The source.</param>
        internal PlanetaryColony(CCPCharacter ccpCharacter, EsiPlanetaryColonyListItem src)
        {
            Character      = ccpCharacter;
            SolarSystem    = StaticGeography.GetSolarSystemByID(src.SolarSystemID);
            PlanetID       = src.PlanetID;
            PlanetTypeID   = src.PlanetType;
            PlanetTypeName = StaticItems.GetItemName(PlanetTypeID);
            PlanetName     = SolarSystem.FindPlanetByID(PlanetID)?.Name ?? EveMonConstants.
                             UnknownText;
            LastUpdate       = src.LastUpdate;
            UpgradeLevel     = src.UpgradeLevel;
            NumberOfPins     = src.NumberOfPins;
            m_layoutResponse = null;

            GetColonyLayout();
        }
コード例 #9
0
 public SerializableWalletTransactionsListItem ToXMLItem()
 {
     return(new SerializableWalletTransactionsListItem()
     {
         ClientID = ClientID,
         ID = ID,
         JournalTransactionID = JournalTransactionID,
         Price = Price,
         Quantity = Quantity,
         StationID = StationID,
         TransactionDate = TransactionDate,
         TransactionType = Buy ? "buy" : "sell",
         TransactionFor = Personal ? "personal" : "corporate",
         TypeID = TypeID,
         TypeName = StaticItems.GetItemName(TypeID)
     });
 }
コード例 #10
0
ファイル: ImplantSetCollection.cs プロジェクト: th-eve/evemon
        /// <summary>
        /// Imports data from an ESI deserialization object.
        /// </summary>
        public void Import(EsiAPIClones serial)
        {
            if (serial == null)
            {
                return;
            }

            m_cloneSets.Clear();
            // Jump clones
            foreach (var clone in serial.JumpClones)
            {
                int    cloneID = clone.JumpCloneID;
                string name    = clone.Name;
                // Try to pick a sane name if it is null
                if (string.IsNullOrEmpty(name))
                {
                    var location = EveIDToStation.GetIDToStation(clone.LocationID);
                    if (location == null)
                    {
                        name = "Clone at location #" + clone.LocationID.ToString(CultureInfo.
                                                                                 InvariantCulture);
                    }
                    else
                    {
                        name = "Clone in " + location.Name;
                    }
                }
                ImplantSet set = new ImplantSet(m_character, name);
                // Jump clone implants
                var jcImplants = new LinkedList <SerializableNewImplant>();
                foreach (int implant in clone.Implants)
                {
                    jcImplants.AddLast(new SerializableNewImplant()
                    {
                        ID   = implant,
                        Name = StaticItems.GetItemName(implant)
                    });
                }
                set.Import(jcImplants);
                m_cloneSets.Add(set);
            }

            EveMonClient.OnCharacterImplantSetCollectionChanged(m_character);
        }
コード例 #11
0
ファイル: PlanetaryPin.cs プロジェクト: Slazanger/evemon
        /// <summary>
        /// Initializes a new instance of the <see cref="PlanetaryPin"/> class.
        /// </summary>
        /// <param name="colony">The colony.</param>
        /// <param name="src">The source.</param>
        internal PlanetaryPin(PlanetaryColony colony, EsiPlanetaryPin src)
        {
            var type      = StaticItems.GetItemByID(src.TypeID);
            var extractor = src.ExtractorDetails;
            var contents  = src.Contents;

            type.ThrowIfNull(nameof(type));

            Colony        = colony;
            ID            = src.PinID;
            TypeID        = src.TypeID;
            TypeName      = type.Name;
            SchematicID   = src.SchematicID;
            InstallTime   = src.InstallTime;
            ExpiryTime    = src.ExpiryTime;
            State         = GetState();
            ContentVolume = GetVolume();

            if (extractor != null)
            {
                CycleTime        = (short)extractor.CycleTime;
                QuantityPerCycle = extractor.QuantityPerCycle;
            }

            // Old EVEMon could only handle one item in contents
            if (contents != null && contents.Count > 0)
            {
                var firstItem = contents[0];
                int typeID    = firstItem.TypeID;
                ContentQuantity = firstItem.Amount;
                ContentTypeID   = typeID;
                ContentTypeName = StaticItems.GetItemName(typeID);
            }
            else
            {
                ContentQuantity = 0;
                ContentTypeID   = 0;
                ContentTypeName = string.Empty;
            }
            LastLaunchTime = src.LastCycleStart;

            GroupName = type.GroupName;
        }
コード例 #12
0
ファイル: Character.cs プロジェクト: Slazanger/evemon
        /// <summary>
        /// Imports data from the given implants information.
        /// </summary>
        /// <param name="result">The serialized implant information</param>
        internal void Import(EsiResult <List <int> > result)
        {
            var implants = result.Result;

            // Implants
            var newImplants = new LinkedList <SerializableNewImplant>();

            foreach (int implant in implants)
            {
                newImplants.AddLast(new SerializableNewImplant()
                {
                    ID   = implant,
                    Name = StaticItems.GetItemName(implant)
                });
            }
            CurrentImplants.Import(newImplants);

            EveMonClient.OnCharacterInfoUpdated(this);
        }
コード例 #13
0
        /// <summary>
        /// Parses the implant list from a lost clone.
        /// </summary>
        /// <param name="typeIDs">The type IDs of lost implants</param>
        /// <returns>A string representation of the implants</returns>
        private static string BuildImplantList(YamlSequenceNode typeIDs)
        {
            string implants;

            if (!typeIDs.Any())
            {
                implants = "None were in the clone";
            }
            else
            {
                int type;
                var sb = new StringBuilder(256);
                // Add all valid implants to the string
                foreach (var typeID in typeIDs)
                {
                    if (typeID.ToString().TryParseInv(out type))
                    {
                        sb.AppendLine().AppendLine("Type: " + StaticItems.GetItemName(type));
                    }
                }
                implants = sb.ToString();
            }
            return(implants);
        }
コード例 #14
0
        /// <summary>
        /// Parses the notification text.
        /// </summary>
        /// <param name="notification">The notification.</param>
        /// <param name="pair">The pair.</param>
        /// <param name="parsedDict">The parsed dictionary.</param>
        public override void Parse(EveNotification notification, KeyValuePair <YamlNode,
                                                                               YamlNode> pair, IDictionary <string, string> parsedDict)
        {
            string           key = pair.Key.ToString(), value = pair.Value.ToString();
            long             valueAsLong;
            decimal          amount;
            double           valueAsDouble;
            int              typeID    = notification.TypeID;
            DateTime         timestamp = notification.SentDate;
            YamlSequenceNode typeIDs;

            // The value is often used as an int64 in the list below, simplify calculation
            if (!value.TryParseInv(out valueAsLong))
            {
                valueAsLong = 0L;
            }
            switch (key.ToUpperInvariant())
            {
            case "CHARID":
            case "SENDERCHARID":
            case "RECEIVERCHARID":
            case "OWNERID":
            case "LOCATIONOWNERID":
            case "DESTROYERID":
            case "INVOKINGCHARID":
            case "PODKILLERID":
            case "NEWCEOID":
            case "OLDCEOID":
            case "CORPID":
            case "VICTIMID":
            case "DECLAREDBYID":
            case "AGAINSTID":
            case "CREDITORID":
            case "FACTIONID":
            case "DEFENDERID":
            case "ENEMYID":
            case "AGGRESSORID":
            case "ALLYID":
            case "MERCID":
            case "AGGRESSORCORPID":
            case "AGGRESSORALLIANCEID":
                parsedDict[key] = EveIDToName.GetIDToName(valueAsLong);
                break;

            case "CLONESTATIONID":
            case "CORPSTATIONID":
            case "LOCATIONID":
            case "STRUCTUREID":
            case "EXTERNALID2":
                parsedDict[key] = EveIDToStation.GetIDToStation(valueAsLong)?.Name ??
                                  EveMonConstants.UnknownText;
                break;

            case "SOLARSYSTEMID":
                // If it overflows the result will be invalid anyways
                parsedDict[key] = StaticGeography.GetSolarSystemName((int)valueAsLong);
                break;

            case "SHIPTYPEID":
            case "TYPEID":
            case "STRUCTURETYPEID":
            case "VICTIMSHIPTYPEID":
                // If it overflows the result will be invalid anyways
                parsedDict[key] = StaticItems.GetItemName((int)valueAsLong);
                break;

            case "MEDALID":
                var medal = notification.CCPCharacter.CharacterMedals.FirstOrDefault(x =>
                                                                                     (x.ID.ToString() == value));
                parsedDict[key] = medal?.Title ?? EveMonConstants.UnknownText;
                parsedDict.Add("medalDescription", medal?.Description ??
                               EveMonConstants.UnknownText);
                break;

            case "AMOUNT":
            case "ISKVALUE":
                // Format as ISK amount
                if (value.TryParseInv(out amount))
                {
                    parsedDict[key] = amount.ToString("N2");
                }
                break;

            case "ENDDATE":
            case "STARTDATE":
            case "DECLOAKTIME":
            case "DESTRUCTTIME":
            case "TIMEFINISHED":
                parsedDict[key] = string.Format(CultureConstants.InvariantCulture,
                                                "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", valueAsLong.
                                                WinTimeStampToDateTime());
                break;

            case "NOTIFICATION_CREATED":
                parsedDict[key] = string.Format(CultureConstants.InvariantCulture,
                                                "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", timestamp);
                break;

            case "DUEDATE":
            case "ISSUEDATE":
                parsedDict[key] = string.Format(CultureConstants.InvariantCulture,
                                                "{0:dddd, MMMM d, yyyy} (EVE Time)", valueAsLong.WinTimeStampToDateTime());
                break;

            case "CAMPAIGNEVENTTYPE":
                switch (value)
                {
                case "1":
                    parsedDict[key] = "Territorial Claim Unit";
                    break;

                case "2":
                    parsedDict[key] = "Infrastructure Hub";
                    break;

                case "3":
                    parsedDict[key] = "Station";
                    break;

                default:
                    parsedDict[key] = EveMonConstants.UnknownText;
                    break;
                }
                break;

            case "TYPEIDS":
                typeIDs = pair.Value as YamlSequenceNode;
                if (typeIDs != null && (typeID == 56 || typeID == 57))
                {
                    parsedDict[key] = BuildImplantList(typeIDs);
                }
                break;

            case "LISTOFTYPESANDQTY":
                typeIDs = pair.Value as YamlSequenceNode;
                if (typeIDs != null)
                {
                    parsedDict[key] = BuildItemList(typeIDs);
                }
                break;

            case "ISHOUSEWARMINGGIFT":
                // Tritanium
                parsedDict[key] = StaticItems.GetItemName(typeID);
                break;

            case "LEVEL":
                if (value.TryParseInv(out valueAsDouble))
                {
                    parsedDict[key] = Standing.Status(valueAsDouble) + " Standing";
                }
                break;

            case "SHIELDVALUE":
            case "ARMORVALUE":
            case "HULLVALUE":
                if (value.TryParseInv(out valueAsDouble))
                {
                    parsedDict[key] = (valueAsDouble * 100.0).ToString("N0");
                }
                break;
            }
        }
コード例 #15
0
 /// <summary>
 /// Imports data from the given character ship information.
 /// </summary>
 /// <param name="ship">The serialized character ship information</param>
 internal void Import(EsiAPIShip ship)
 {
     ShipName     = ship.ShipName;
     ShipTypeName = StaticItems.GetItemName(ship.ShipTypeID);
     EveMonClient.OnCharacterInfoUpdated(this);
 }
コード例 #16
0
        /// <summary>
        /// Parses the notification text.
        /// </summary>
        /// <param name="notification">The notification.</param>
        /// <param name="pair">The pair.</param>
        /// <param name="parsedDict">The parsed dictionary.</param>
        public override void Parse(EveNotification notification, KeyValuePair <YamlNode, YamlNode> pair,
                                   IDictionary <string, string> parsedDict)
        {
            string key = pair.Key.ToString(), value = pair.Value.ToString();

            switch (key.ToUpperInvariant())
            {
            case "CHARID":
            case "SENDERCHARID":
            case "RECEIVERCHARID":
            case "OWNERID":
            case "LOCATIONOWNERID":
            case "DESTROYERID":
            case "INVOKINGCHARID":
            case "PODKILLERID":
            case "NEWCEOID":
            case "OLDCEOID":
            case "CORPID":
            case "VICTIMID":
                parsedDict[key] = EveIDToName.GetIDToName(long.Parse(value));
                break;

            case "CLONESTATIONID":
            case "CORPSTATIONID":
            case "LOCATIONID":
                parsedDict[key] = EveIDToStation.GetIDToStation(long.Parse(value))?.Name ??
                                  EveMonConstants.UnknownText;
                break;

            case "SOLARSYSTEMID":
                parsedDict[key] = StaticGeography.GetSolarSystemName(int.Parse(value));
                break;

            case "SHIPTYPEID":
            case "TYPEID":
            case "STRUCTURETYPEID":
            case "VICTIMSHIPTYPEID":
                parsedDict[key] = StaticItems.GetItemName(int.Parse(value));
                break;

            case "MEDALID":
                var medal = notification.CCPCharacter.CharacterMedals.FirstOrDefault(x =>
                                                                                     (x.ID.ToString() == value));

                parsedDict[key] = medal?.Title ?? EveMonConstants.UnknownText;
                parsedDict.Add("medalDescription", medal?.Description ??
                               EveMonConstants.UnknownText);
                break;

            case "ENDDATE":
            case "STARTDATE":
            case "DECLOAKTIME":
                parsedDict[key] = string.Format(CultureConstants.InvariantCulture,
                                                "{0:dddd, MMMM d, yyyy HH:mm} (EVE Time)", long.Parse(value).
                                                WinTimeStampToDateTime());
                break;

            case "NOTIFICATION_CREATED":
                parsedDict[key] = string.Format(CultureConstants.InvariantCulture,
                                                "{0:dddd, MMMM d, yyyy} (EVE Time)", long.Parse(value).
                                                WinTimeStampToDateTime());
                break;

            case "CAMPAIGNEVENTTYPE":
                switch (value)
                {
                case "1":
                    parsedDict[key] = "Territorial Claim Unit";
                    break;

                case "2":
                    parsedDict[key] = "Infrastructure Hub";
                    break;

                case "3":
                    parsedDict[key] = "Station";
                    break;

                default:
                    parsedDict[key] = EveMonConstants.UnknownText;
                    break;
                }
                break;

            case "TYPEIDS":
                YamlSequenceNode typeIDs = pair.Value as YamlSequenceNode;
                if (typeIDs == null)
                {
                    break;
                }
                switch (notification.TypeID)
                {
                case 56:
                case 57:
                {
                    if (!typeIDs.Any())
                    {
                        parsedDict[key] = "None were in the clone";
                    }
                    else
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (var typeID in typeIDs)
                        {
                            int type = 0;
                            int.TryParse(typeID.ToString(), out type);
                            sb.AppendLine().AppendLine($"Type: {StaticItems.GetItemName(type)}");
                        }
                        parsedDict[key] = sb.ToString();
                    }
                }
                break;
                }
                break;

            case "ISHOUSEWARMINGGIFT":
                if (Convert.ToBoolean(pair.Value) && notification.TypeID == 34)
                {
                    // Tritanium
                    parsedDict[key] = StaticItems.GetItemName(notification.TypeID);
                }
                break;

            case "LEVEL":
                parsedDict[key] = $"{Standing.Status(double.Parse(value))} Standing";
                break;
            }
        }
コード例 #17
0
ファイル: Character.cs プロジェクト: kinseytamsin/evemon
 /// <summary>
 /// Imports data from the given character ship information.
 /// </summary>
 /// <param name="ship">The serialized character ship information</param>
 internal void Import(EsiAPIShip ship)
 {
     ShipName     = ship.ShipName;
     ShipTypeName = StaticItems.GetItemName(ship.ShipTypeID);
 }