public SkillInTraining Parse(XmlDocument xmlDocument)
        {
            this.CheckVersion(xmlDocument);
            SkillInTraining skilltraining = new SkillInTraining();

            skilltraining.ParseCommonElements(xmlDocument);
            skilltraining.SkillCurrentlyInTraining = Convert.ToBoolean(Convert.ToInt32(xmlDocument.SelectSingleNode("/eveapi/result/skillInTraining").InnerText));
            if (skilltraining.SkillCurrentlyInTraining)
            {
                skilltraining.TrainingEndTime       = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(xmlDocument.SelectSingleNode("/eveapi/result/trainingEndTime").InnerText);
                skilltraining.TrainingStartTime     = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(xmlDocument.SelectSingleNode("/eveapi/result/trainingStartTime").InnerText);
                skilltraining.TrainingTypeId        = Convert.ToInt32(xmlDocument.SelectSingleNode("/eveapi/result/trainingTypeID").InnerText, CultureInfo.InvariantCulture);
                skilltraining.TrainingStartSP       = Convert.ToInt32(xmlDocument.SelectSingleNode("/eveapi/result/trainingStartSP").InnerText, CultureInfo.InvariantCulture);
                skilltraining.TrainingDestinationSP = Convert.ToInt32(xmlDocument.SelectSingleNode("/eveapi/result/trainingDestinationSP").InnerText, CultureInfo.InvariantCulture);
                skilltraining.TrainingToLevel       = Convert.ToInt32(xmlDocument.SelectSingleNode("/eveapi/result/trainingToLevel").InnerText, CultureInfo.InvariantCulture);

                skilltraining.TrainingEndTimeLocal   = TimeUtilities.ConvertCCPToLocalTime(skilltraining.TrainingEndTime);
                skilltraining.TrainingStartTimeLocal = TimeUtilities.ConvertCCPToLocalTime(skilltraining.TrainingStartTime);
            }
            else
            {
                skilltraining.TrainingEndTime        = DateTime.MinValue;
                skilltraining.TrainingStartTime      = DateTime.MinValue;
                skilltraining.TrainingEndTimeLocal   = DateTime.MinValue;
                skilltraining.TrainingStartTimeLocal = DateTime.MinValue;
                skilltraining.TrainingTypeId         = 0;
                skilltraining.TrainingStartSP        = 0;
                skilltraining.TrainingDestinationSP  = 0;
                skilltraining.TrainingToLevel        = 0;
            }
            return(skilltraining);
        }
        /// <summary>
        /// Create an WalletTransactionItem by parsing a single row
        /// </summary>
        /// <param name="walletTransactionRow"></param>
        /// <returns></returns>
        private static WalletTransactions.WalletTransactionItem ParseTransactionRow(XmlNode walletTransactionRow)
        {
            WalletTransactions.WalletTransactionItem walletTransactionItem = new WalletTransactions.WalletTransactionItem();

            walletTransactionItem.TransactionDateTime      = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(walletTransactionRow.Attributes["transactionDateTime"].InnerText);
            walletTransactionItem.TransactionDateTimeLocal = TimeUtilities.ConvertCCPToLocalTime(walletTransactionItem.TransactionDateTime);
            walletTransactionItem.TransactionId            = Convert.ToInt32(walletTransactionRow.Attributes["transactionID"].InnerText, CultureInfo.InvariantCulture);
            walletTransactionItem.Quantity   = Convert.ToInt32(walletTransactionRow.Attributes["quantity"].InnerText, CultureInfo.InvariantCulture);
            walletTransactionItem.TypeName   = walletTransactionRow.Attributes["typeName"].InnerText;
            walletTransactionItem.TypeId     = Convert.ToInt32(walletTransactionRow.Attributes["typeID"].InnerText, CultureInfo.InvariantCulture);
            walletTransactionItem.Price      = (float)Convert.ToDouble(walletTransactionRow.Attributes["price"].InnerText, CultureInfo.InvariantCulture);
            walletTransactionItem.ClientId   = Convert.ToInt32(walletTransactionRow.Attributes["clientID"].InnerText, CultureInfo.InvariantCulture);
            walletTransactionItem.ClientName = walletTransactionRow.Attributes["clientName"].InnerText;

            //These are only present in the corp version
            if (walletTransactionRow.Attributes.GetNamedItem("characterID") != null)
            {
                walletTransactionItem.CharacterId = Convert.ToInt32(walletTransactionRow.Attributes["characterID"].InnerText, CultureInfo.InvariantCulture);
            }
            if (walletTransactionRow.Attributes.GetNamedItem("characterName") != null)
            {
                walletTransactionItem.CharacterName = walletTransactionRow.Attributes["characterName"].InnerText;
            }

            walletTransactionItem.StationId       = Convert.ToInt32(walletTransactionRow.Attributes["stationID"].InnerText, CultureInfo.InvariantCulture);
            walletTransactionItem.StationName     = walletTransactionRow.Attributes["stationName"].InnerText;
            walletTransactionItem.TransactionType = walletTransactionRow.Attributes["transactionType"].InnerText;
            walletTransactionItem.TransactionFor  = walletTransactionRow.Attributes["transactionFor"].InnerText;

            return(walletTransactionItem);
        }
Esempio n. 3
0
        public StarbaseList Parse(XmlDocument xmlDocument)
        {
            this.CheckVersion(xmlDocument);
            StarbaseList starbaseList = new StarbaseList();

            starbaseList.ParseCommonElements(xmlDocument);

            List <StarbaseList.StarbaseListItem> starbaseListItems = new List <StarbaseList.StarbaseListItem>();

            foreach (XmlNode starbaseNode in xmlDocument.SelectNodes("//rowset[@name='starbases']/row"))
            {
                StarbaseList.StarbaseListItem starbase = new StarbaseList.StarbaseListItem();
                starbase.ItemId          = Convert.ToInt32(starbaseNode.Attributes["itemID"].InnerText, CultureInfo.InvariantCulture);
                starbase.TypeId          = Convert.ToInt32(starbaseNode.Attributes["typeID"].InnerText, CultureInfo.InvariantCulture);
                starbase.LocationId      = Convert.ToInt32(starbaseNode.Attributes["locationID"].InnerText, CultureInfo.InvariantCulture);
                starbase.MoonId          = Convert.ToInt32(starbaseNode.Attributes["moonID"].InnerText, CultureInfo.InvariantCulture);
                starbase.StateTimestamp  = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(starbaseNode.Attributes["stateTimestamp"].InnerText);
                starbase.OnlineTimestamp = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(starbaseNode.Attributes["onlineTimestamp"].InnerText);

                starbase.StateTimestampLocal  = TimeUtilities.ConvertCCPToLocalTime(starbase.StateTimestamp);
                starbase.OnlineTimestampLocal = TimeUtilities.ConvertCCPToLocalTime(starbase.OnlineTimestamp);

                switch (Convert.ToInt32(starbaseNode.Attributes["state"].InnerText))
                {
                case 1:
                    starbase.State = StarbaseList.StarbaseState.AnchoredOrOffline;
                    break;

                case 2:
                    starbase.State = StarbaseList.StarbaseState.Onlining;
                    break;

                case 3:
                    starbase.State = StarbaseList.StarbaseState.Reinforced;
                    break;

                case 4:
                    starbase.State = StarbaseList.StarbaseState.Online;
                    break;

                default:
                    break;
                }

                starbaseListItems.Add(starbase);
            }

            starbaseList.StarbaseListItems = starbaseListItems.ToArray();
            return(starbaseList);
        }
        /// <summary>
        /// Create a Wallet Journal Entry by parsing a single row
        /// </summary>
        /// <param name="walletJournalRow">Xml Wallet Journal Entry</param>
        /// <returns>Populated object</returns>
        private static WalletJournal.WalletJournalItem ParseTransactionRow(XmlNode walletJournalRow)
        {
            WalletJournal.WalletJournalItem entryItem = new WalletJournal.WalletJournalItem();

            entryItem.Date       = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(walletJournalRow.Attributes["date"].InnerText);
            entryItem.DateLocal  = TimeUtilities.ConvertCCPToLocalTime(entryItem.Date);
            entryItem.RefId      = Convert.ToInt32(walletJournalRow.Attributes["refID"].InnerText, CultureInfo.InvariantCulture);
            entryItem.RefTypeId  = Convert.ToInt32(walletJournalRow.Attributes["refTypeID"].InnerText, CultureInfo.InvariantCulture);
            entryItem.OwnerName1 = walletJournalRow.Attributes["ownerName1"].InnerText;
            entryItem.OwnerId1   = Convert.ToInt32(walletJournalRow.Attributes["ownerID1"].InnerText, CultureInfo.InvariantCulture);
            entryItem.OwnerName2 = walletJournalRow.Attributes["ownerName2"].InnerText;
            entryItem.OwnerId2   = Convert.ToInt32(walletJournalRow.Attributes["ownerID2"].InnerText, CultureInfo.InvariantCulture);
            entryItem.ArgName1   = walletJournalRow.Attributes["argName1"].InnerText;
            entryItem.ArgId1     = Convert.ToInt32(walletJournalRow.Attributes["argID1"].InnerText, CultureInfo.InvariantCulture);
            entryItem.Amount     = Convert.ToDouble(walletJournalRow.Attributes["amount"].InnerText, CultureInfo.InvariantCulture);
            entryItem.Balance    = Convert.ToDouble(walletJournalRow.Attributes["balance"].InnerText, CultureInfo.InvariantCulture);
            entryItem.Reason     = walletJournalRow.Attributes["reason"].InnerText;

            //These are only present in the corp version
            if (walletJournalRow.Attributes.GetNamedItem("taxReceiverID") != null)
            {
                if (walletJournalRow.Attributes["taxAmount"].InnerText.CompareTo(string.Empty) != 0)
                {
                    entryItem.TaxRecieverID = Convert.ToInt32(walletJournalRow.Attributes["taxReceiverID"].InnerText, CultureInfo.InvariantCulture);
                }
                else
                {
                    entryItem.TaxRecieverID = 0;
                }
            }
            if (walletJournalRow.Attributes.GetNamedItem("taxAmount") != null)
            {
                if (walletJournalRow.Attributes["taxAmount"].InnerText.CompareTo(string.Empty) != 0)
                {
                    entryItem.TaxAmount = Convert.ToDecimal(walletJournalRow.Attributes["taxAmount"].InnerText, CultureInfo.InstalledUICulture);
                }
                else
                {
                    entryItem.TaxAmount = 0;
                }
            }


            return(entryItem);
        }
Esempio n. 5
0
        /// <summary>
        /// Create an JournalEntryItem by parsing a single row
        /// </summary>
        /// <param name="journalTransactionRow"></param>
        /// <returns></returns>
        private static JournalEntries.JournalEntryItem ParseTransactionRow(XmlNode journalTransactionRow)
        {
            JournalEntries.JournalEntryItem journalEntryItem = new JournalEntries.JournalEntryItem();

            journalEntryItem.Date       = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(journalTransactionRow.Attributes["date"].InnerText);
            journalEntryItem.DateLocal  = TimeUtilities.ConvertCCPToLocalTime(journalEntryItem.Date);
            journalEntryItem.RefId      = Convert.ToInt32(journalTransactionRow.Attributes["refID"].InnerText, CultureInfo.InvariantCulture);
            journalEntryItem.RefTypeId  = Convert.ToInt32(journalTransactionRow.Attributes["refTypeID"].InnerText, CultureInfo.InvariantCulture);
            journalEntryItem.OwnerName1 = journalTransactionRow.Attributes["ownerName1"].InnerText;
            journalEntryItem.OwnerId1   = Convert.ToInt32(journalTransactionRow.Attributes["ownerID1"].InnerText, CultureInfo.InvariantCulture);
            journalEntryItem.OwnerName2 = journalTransactionRow.Attributes["ownerName2"].InnerText;
            journalEntryItem.OwnerId2   = Convert.ToInt32(journalTransactionRow.Attributes["ownerID2"].InnerText, CultureInfo.InvariantCulture);
            journalEntryItem.ArgName1   = journalTransactionRow.Attributes["argName1"].InnerText;
            journalEntryItem.ArgId1     = Convert.ToInt32(journalTransactionRow.Attributes["argID1"].InnerText, CultureInfo.InvariantCulture);
            journalEntryItem.Amount     = Convert.ToDouble(journalTransactionRow.Attributes["amount"].InnerText, CultureInfo.InvariantCulture);
            journalEntryItem.Balance    = Convert.ToDouble(journalTransactionRow.Attributes["balance"].InnerText, CultureInfo.InvariantCulture);
            journalEntryItem.Reason     = journalTransactionRow.Attributes["reason"].InnerText;

            return(journalEntryItem);
        }
        public SkillQueue Parse(XmlDocument xmlDocument)
        {
            this.CheckVersion(xmlDocument);
            SkillQueue skillqueue = new SkillQueue();

            skillqueue.ParseCommonElements(xmlDocument);
            List <SkillQueue.Skill> skills = new List <SkillQueue.Skill>();

            SkillQueue.Skill skill;

            XmlNodeList nodelist = xmlDocument.SelectNodes("//rowset[@name='skillqueue']/row");

            foreach (XmlNode node in nodelist)
            {
                skill = new SkillQueue.Skill(
                    Convert.ToInt32(node.Attributes["queuePosition"].InnerText),
                    Convert.ToInt32(node.Attributes["typeID"].InnerText),
                    Convert.ToInt32(node.Attributes["level"].InnerText),
                    Convert.ToInt32(node.Attributes["startSP"].InnerText),
                    Convert.ToInt32(node.Attributes["endSP"].InnerText),
                    Convert.ToDateTime(node.Attributes["startTime"].InnerText),
                    Convert.ToDateTime(node.Attributes["endTime"].InnerText),
                    TimeUtilities.ConvertCCPToLocalTime(Convert.ToDateTime(node.Attributes["startTime"].InnerText)),
                    TimeUtilities.ConvertCCPToLocalTime(Convert.ToDateTime(node.Attributes["endTime"].InnerText)));
                skills.Add(skill);

                /*
                 * skillqueue.Add(Convert.ToInt32(node.Attributes["queuePosition"].InnerText),
                 *  Convert.ToInt32(node.Attributes["typeID"].InnerText),
                 *  Convert.ToInt32(node.Attributes["level"].InnerText),
                 *  Convert.ToInt32(node.Attributes["startSP"].InnerText),
                 *  Convert.ToInt32(node.Attributes["endSP"].InnerText),
                 *  Convert.ToDateTime(node.Attributes["startTime"].InnerText),
                 *  Convert.ToDateTime(node.Attributes["endTime"].InnerText));
                 */
            }
            skillqueue.SkillList = skills.ToArray();
            return(skillqueue);
        }
        public AllianceList Parse(XmlDocument xmlDocument)
        {
            this.CheckVersion(xmlDocument);
            AllianceList allianceList = new AllianceList();

            allianceList.ParseCommonElements(xmlDocument);

            List <AllianceList.AllianceListItem> parsedAllianceListItems = new List <AllianceList.AllianceListItem>();

            foreach (XmlNode allianceRow in xmlDocument.SelectNodes("//rowset[@name='alliances']/row"))
            {
                AllianceList.AllianceListItem ali = new AllianceList.AllianceListItem();
                ali.Name           = allianceRow.Attributes["name"].InnerText;
                ali.ShortName      = allianceRow.Attributes["shortName"].InnerText;
                ali.AllianceId     = Convert.ToInt32(allianceRow.Attributes["allianceID"].InnerText, CultureInfo.InvariantCulture);
                ali.ExecutorCorpId = Convert.ToInt32(allianceRow.Attributes["executorCorpID"].InnerText, CultureInfo.InvariantCulture);
                ali.MemberCount    = Convert.ToInt32(allianceRow.Attributes["memberCount"].InnerText, CultureInfo.InvariantCulture);
                ali.StartDate      = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(allianceRow.Attributes["startDate"].InnerText);
                ali.StartDateLocal = TimeUtilities.ConvertCCPToLocalTime(ali.StartDate);

                List <AllianceList.CorporationListItem> parsedCorporationListItems = new List <AllianceList.CorporationListItem>();
                foreach (XmlNode corpRow in allianceRow.SelectNodes("rowset[@name='memberCorporations']/row"))
                {
                    AllianceList.CorporationListItem cli = new AllianceList.CorporationListItem();
                    cli.CorporationId  = Convert.ToInt32(corpRow.Attributes["corporationID"].InnerText, CultureInfo.InvariantCulture);
                    cli.StartDate      = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(corpRow.Attributes["startDate"].InnerText);
                    cli.StartDateLocal = TimeUtilities.ConvertCCPToLocalTime(cli.StartDate);

                    parsedCorporationListItems.Add(cli);
                }
                ali.CorporationListItems = parsedCorporationListItems.ToArray();

                parsedAllianceListItems.Add(ali);
            }

            allianceList.AllianceListItems = parsedAllianceListItems.ToArray();
            return(allianceList);
        }
Esempio n. 8
0
        public MemberTracking Parse(XmlDocument xmlDocument)
        {
            this.CheckVersion(xmlDocument);
            MemberTracking memberTracking = new MemberTracking();

            memberTracking.ParseCommonElements(xmlDocument);

            List <MemberTracking.Member> parsedMemeberTrackingItems = new List <MemberTracking.Member>();

            foreach (XmlNode row in xmlDocument.SelectNodes("//rowset[@name='members']/row"))
            {
                MemberTracking.Member mti = new MemberTracking.Member();
                mti.CharacterId    = Convert.ToInt32(row.Attributes["characterID"].InnerText, CultureInfo.InvariantCulture);
                mti.Name           = row.Attributes["name"].InnerText;
                mti.BaseId         = Convert.ToInt32(row.Attributes["baseID"].InnerText, CultureInfo.InvariantCulture);
                mti.Base           = row.Attributes["base"].InnerText;
                mti.Title          = row.Attributes["title"].InnerText;
                mti.LocationId     = Convert.ToInt32(row.Attributes["locationID"].InnerText, CultureInfo.InvariantCulture);
                mti.Location       = row.Attributes["location"].InnerText;
                mti.ShipTypeId     = Convert.ToInt32(row.Attributes["shipTypeID"].InnerText, CultureInfo.InvariantCulture);
                mti.ShipType       = row.Attributes["shipType"].InnerText;
                mti.RolesMask      = row.Attributes["roles"].InnerText;
                mti.GrantableRoles = row.Attributes["grantableRoles"].InnerText;

                mti.StartDateTime       = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(row.Attributes["startDateTime"].InnerText);
                mti.LogonDateTime       = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(row.Attributes["logonDateTime"].InnerText);
                mti.LogoffDateTime      = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(row.Attributes["logoffDateTime"].InnerText);
                mti.StartDateTimeLocal  = TimeUtilities.ConvertCCPToLocalTime(mti.StartDateTime);
                mti.LogonDateTimeLocal  = TimeUtilities.ConvertCCPToLocalTime(mti.LogonDateTime);
                mti.LogoffDateTimeLocal = TimeUtilities.ConvertCCPToLocalTime(mti.LogoffDateTime);

                parsedMemeberTrackingItems.Add(mti);
            }

            memberTracking.Members = parsedMemeberTrackingItems.ToArray();
            return(memberTracking);
        }
        /// <summary>
        /// Create an IndustryJobListItem by parsing a single row
        /// </summary>
        /// <param name="industryJobRow">An xml row containing an industry job</param>
        /// <param name="industryJobList"></param>
        /// <returns></returns>
        private static IndustryJobList.IndustryJobListItem ParseIndustryJobRow(XmlNode industryJobRow, IndustryJobList industryJobList)
        {
            IndustryJobList.IndustryJobListItem IndustryJobListItem = new IndustryJobList.IndustryJobListItem();

            IndustryJobListItem.JobId                          = Convert.ToInt32(industryJobRow.Attributes["jobID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.AssemblyLineId                 = Convert.ToInt32(industryJobRow.Attributes["assemblyLineID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.ContainerId                    = Convert.ToInt32(industryJobRow.Attributes["containerID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledItemId                = Convert.ToInt32(industryJobRow.Attributes["installedItemID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledItemLocationId        = Convert.ToInt32(industryJobRow.Attributes["installedItemLocationID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledItemQuantity          = Convert.ToInt32(industryJobRow.Attributes["installedItemQuantity"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledItemProductivityLevel = Convert.ToInt32(industryJobRow.Attributes["installedItemProductivityLevel"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledItemMaterialLevel     = Convert.ToInt32(industryJobRow.Attributes["installedItemMaterialLevel"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledItemLicensedProductionRunsRemaining = Convert.ToInt32(industryJobRow.Attributes["installedItemLicensedProductionRunsRemaining"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.OutputLocationId         = Convert.ToInt32(industryJobRow.Attributes["outputLocationID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstallerId              = Convert.ToInt32(industryJobRow.Attributes["installerID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.Runs                     = Convert.ToInt32(industryJobRow.Attributes["runs"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.LicensedProductionRuns   = Convert.ToInt32(industryJobRow.Attributes["licensedProductionRuns"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledInSolarSystemId = Convert.ToInt32(industryJobRow.Attributes["installedInSolarSystemID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.ContainerLocationId      = Convert.ToInt32(industryJobRow.Attributes["containerLocationID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.MaterialMultiplier       = Convert.ToDouble(industryJobRow.Attributes["materialMultiplier"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.CharMaterialMultiplier   = Convert.ToDouble(industryJobRow.Attributes["charMaterialMultiplier"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.TimeMultiplier           = Convert.ToDouble(industryJobRow.Attributes["timeMultiplier"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.CharTimeMultiplier       = Convert.ToDouble(industryJobRow.Attributes["charTimeMultiplier"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledItemTypeId      = Convert.ToInt32(industryJobRow.Attributes["installedItemTypeID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.OutputTypeId             = Convert.ToInt32(industryJobRow.Attributes["outputTypeID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.ContainerTypeId          = Convert.ToInt32(industryJobRow.Attributes["containerTypeID"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledItemCopy        = Convert.ToBoolean(Convert.ToInt32(industryJobRow.Attributes["installedItemCopy"].InnerText, CultureInfo.InvariantCulture), CultureInfo.InvariantCulture);
            IndustryJobListItem.Completed                = Convert.ToBoolean(Convert.ToInt32(industryJobRow.Attributes["completed"].InnerText, CultureInfo.InvariantCulture), CultureInfo.InvariantCulture);
            IndustryJobListItem.CompletedSuccessfully    = Convert.ToBoolean(Convert.ToInt32(industryJobRow.Attributes["completedSuccessfully"].InnerText, CultureInfo.InvariantCulture), CultureInfo.InvariantCulture);
            IndustryJobListItem.InstalledItemFlag        = Convert.ToInt32(industryJobRow.Attributes["installedItemFlag"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.OutputFlag               = Convert.ToInt32(industryJobRow.Attributes["outputFlag"].InnerText, CultureInfo.InvariantCulture);
            IndustryJobListItem.ActivityId               = Convert.ToInt32(industryJobRow.Attributes["activityID"].InnerText, CultureInfo.InvariantCulture);

            switch (Convert.ToInt32(industryJobRow.Attributes["activityID"].InnerText, CultureInfo.InvariantCulture))
            {
            case 1:
                IndustryJobListItem.Activity = Activities.Manufacturing;
                break;

            case 2:
                IndustryJobListItem.Activity = Activities.TechnologyResearch;
                break;

            case 3:
                IndustryJobListItem.Activity = Activities.TimeEfficiency;
                break;

            case 4:
                IndustryJobListItem.Activity = Activities.MaterialEfficiency;
                break;

            case 5:
                IndustryJobListItem.Activity = Activities.Copying;
                break;

            case 6:
                IndustryJobListItem.Activity = Activities.Duplicating;
                break;

            case 7:
                IndustryJobListItem.Activity = Activities.ReverseEngineering;
                break;

            case 8:
                IndustryJobListItem.Activity = Activities.Invention;
                break;

            default:
                IndustryJobListItem.Activity = Activities.Unknown;
                break;
            }

            switch (Convert.ToInt32(industryJobRow.Attributes["completedStatus"].InnerText, CultureInfo.InvariantCulture))
            {
            case 0:
                IndustryJobListItem.CompletedStatus = IndustryJobCompletedStatuses.Failed;
                break;

            case 1:
                IndustryJobListItem.CompletedStatus = IndustryJobCompletedStatuses.Delivered;
                break;

            case 2:
                IndustryJobListItem.CompletedStatus = IndustryJobCompletedStatuses.Aborted;
                break;

            case 3:
                IndustryJobListItem.CompletedStatus = IndustryJobCompletedStatuses.GM_Aborted;
                break;

            case 4:
                IndustryJobListItem.CompletedStatus = IndustryJobCompletedStatuses.Unachored;
                break;

            case 5:
                IndustryJobListItem.CompletedStatus = IndustryJobCompletedStatuses.Destroyed;
                break;

            default:
                break;
            }

            IndustryJobListItem.InstallTime         = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(industryJobRow.Attributes["installTime"].InnerText);
            IndustryJobListItem.BeginProductionTime = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(industryJobRow.Attributes["beginProductionTime"].InnerText);
            IndustryJobListItem.EndProductionTime   = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(industryJobRow.Attributes["endProductionTime"].InnerText);
            IndustryJobListItem.PauseProductionTime = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(industryJobRow.Attributes["pauseProductionTime"].InnerText);

            IndustryJobListItem.InstallTimeLocal         = TimeUtilities.ConvertCCPToLocalTime(IndustryJobListItem.InstallTime);
            IndustryJobListItem.BeginProductionTimeLocal = TimeUtilities.ConvertCCPToLocalTime(IndustryJobListItem.BeginProductionTime);
            IndustryJobListItem.EndProductionTimeLocal   = TimeUtilities.ConvertCCPToLocalTime(IndustryJobListItem.EndProductionTime);
            IndustryJobListItem.PauseProductionTimeLocal = TimeUtilities.ConvertCCPToLocalTime(IndustryJobListItem.PauseProductionTime);

            return(IndustryJobListItem);
        }
Esempio n. 10
0
        public KillLog Parse(XmlDocument xmlDocument)
        {
            this.CheckVersion(xmlDocument);
            KillLog killLog = new KillLog();

            killLog.ParseCommonElements(xmlDocument);

            //Kills outer loop
            List <KillLog.Kill> killList = new List <KillLog.Kill>();

            foreach (XmlNode Kill in xmlDocument.SelectNodes("//rowset[@name='kills']/row"))
            {
                KillLog.Kill tmpKill = new KillLog.Kill();

                //Kill Info
                tmpKill.KillId        = Convert.ToInt32(Kill.Attributes["killID"].InnerText, CultureInfo.InvariantCulture);
                tmpKill.SolarSystemId = Convert.ToInt32(Kill.Attributes["solarSystemID"].InnerText, CultureInfo.InvariantCulture);
                tmpKill.KillTime      = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(Kill.Attributes["killTime"].InnerText);
                tmpKill.KillTimeLocal = TimeUtilities.ConvertCCPToLocalTime(tmpKill.KillTime);
                tmpKill.MoonId        = Convert.ToInt32(Kill.Attributes["moonID"].InnerText, CultureInfo.InvariantCulture);

                //Victim
                XmlNode victimNode = Kill.SelectSingleNode("./victim");
                tmpKill.Victim.CharacterId     = Convert.ToInt32(victimNode.Attributes["characterID"].InnerText, CultureInfo.InvariantCulture);
                tmpKill.Victim.CharacterName   = victimNode.Attributes["characterName"].InnerText;
                tmpKill.Victim.CorporationId   = Convert.ToInt32(victimNode.Attributes["corporationID"].InnerText, CultureInfo.InvariantCulture);
                tmpKill.Victim.CorporationName = victimNode.Attributes["corporationName"].InnerText;
                tmpKill.Victim.AllianceId      = Convert.ToInt32(victimNode.Attributes["allianceID"].InnerText, CultureInfo.InvariantCulture);
                tmpKill.Victim.AllianceName    = (victimNode.Attributes.GetNamedItem("allianceName") != null) ? victimNode.Attributes["allianceName"].InnerText : "";
                tmpKill.Victim.DamageTaken     = Convert.ToInt32(victimNode.Attributes["damageTaken"].InnerText, CultureInfo.InvariantCulture);
                tmpKill.Victim.ShipTypeId      = Convert.ToInt32(victimNode.Attributes["shipTypeID"].InnerText, CultureInfo.InvariantCulture);

                //Atackers
                List <KillLog.Attacker> attackerList = new List <KillLog.Attacker>();
                foreach (XmlNode attacker in Kill.SelectNodes("./rowset[@name='attackers']/row"))
                {
                    KillLog.Attacker tmpAttacker = new KillLog.Attacker();
                    tmpAttacker.CharacterId     = Convert.ToInt32(attacker.Attributes["characterID"].InnerText, CultureInfo.InvariantCulture);
                    tmpAttacker.CharacterName   = attacker.Attributes["characterName"].InnerText;
                    tmpAttacker.CorporationId   = Convert.ToInt32(attacker.Attributes["corporationID"].InnerText, CultureInfo.InvariantCulture);
                    tmpAttacker.CorporationName = attacker.Attributes["corporationName"].InnerText;
                    tmpAttacker.AllianceId      = Convert.ToInt32(attacker.Attributes["allianceID"].InnerText, CultureInfo.InvariantCulture);
                    tmpAttacker.AllianceName    = attacker.Attributes["allianceName"].InnerText;
                    tmpAttacker.SecurityStatus  = Convert.ToDouble(attacker.Attributes["securityStatus"].InnerText, CultureInfo.InvariantCulture);
                    tmpAttacker.DamageDone      = Convert.ToInt32(attacker.Attributes["damageDone"].InnerText, CultureInfo.InvariantCulture);
                    tmpAttacker.FinalBlow       = Convert.ToBoolean(Convert.ToInt32(attacker.Attributes["finalBlow"].InnerText, CultureInfo.InvariantCulture), CultureInfo.InvariantCulture);
                    tmpAttacker.WeaponTypeId    = Convert.ToInt32(attacker.Attributes["weaponTypeID"].InnerText, CultureInfo.InvariantCulture);
                    tmpAttacker.ShipTypeId      = Convert.ToInt32(attacker.Attributes["shipTypeID"].InnerText, CultureInfo.InvariantCulture);
                    attackerList.Add(tmpAttacker);
                }
                tmpKill.Attackers = attackerList.ToArray();

                //Items
                List <KillLog.Item> itemList = new List <KillLog.Item>();
                foreach (XmlNode item in Kill.SelectNodes("./rowset[@name='items']/row"))
                {
                    itemList.Add(ParseItemRow(item));
                }
                tmpKill.Items = itemList.ToArray();

                killList.Add(tmpKill);
            }
            killLog.Kills = killList.ToArray();
            return(killLog);
        }
        /// <summary>
        /// Create an MarketOrderItem by parsing a single row
        /// </summary>
        /// <param name="marketOrderRow"></param>
        /// <returns></returns>
        private static MarketOrders.MarketOrderItem ParseTransactionRow(XmlNode marketOrderRow)
        {
            MarketOrders.MarketOrderItem marketItem = new MarketOrders.MarketOrderItem();

            marketItem.OrderId      = Convert.ToInt32(marketOrderRow.Attributes["orderID"].InnerText, CultureInfo.InvariantCulture);
            marketItem.CharId       = Convert.ToInt64(marketOrderRow.Attributes["charID"].InnerText, CultureInfo.InvariantCulture);
            marketItem.StationId    = Convert.ToInt64(marketOrderRow.Attributes["stationID"].InnerText, CultureInfo.InvariantCulture);
            marketItem.VolEntered   = Convert.ToInt64(marketOrderRow.Attributes["volEntered"].InnerText, CultureInfo.InvariantCulture);
            marketItem.VolRemaining = Convert.ToInt64(marketOrderRow.Attributes["volRemaining"].InnerText, CultureInfo.InvariantCulture);
            marketItem.MinVolume    = Convert.ToInt64(marketOrderRow.Attributes["minVolume"].InnerText, CultureInfo.InvariantCulture);

            switch (Convert.ToInt32(marketOrderRow.Attributes["orderState"].InnerText, CultureInfo.InvariantCulture))
            {
            case 0:
                marketItem.OrderState = MarketOrders.MarketOrderState.OpenActive;
                break;

            case 1:
                marketItem.OrderState = MarketOrders.MarketOrderState.Closed;
                break;

            case 2:
                marketItem.OrderState = MarketOrders.MarketOrderState.ExpiredFulfilled;
                break;

            case 3:
                marketItem.OrderState = MarketOrders.MarketOrderState.Canceled;
                break;

            case 4:
                marketItem.OrderState = MarketOrders.MarketOrderState.Pending;
                break;

            case 5:
                marketItem.OrderState = MarketOrders.MarketOrderState.CharacterDeleted;
                break;

            default:
                break;
            }

            marketItem.TypeId      = Convert.ToInt64(marketOrderRow.Attributes["typeID"].InnerText, CultureInfo.InvariantCulture);
            marketItem.Range       = Convert.ToInt32(marketOrderRow.Attributes["range"].InnerText, CultureInfo.InvariantCulture);
            marketItem.AccountKey  = Convert.ToInt32(marketOrderRow.Attributes["accountKey"].InnerText, CultureInfo.InvariantCulture);
            marketItem.Duration    = Convert.ToInt32(marketOrderRow.Attributes["duration"].InnerText, CultureInfo.InvariantCulture);
            marketItem.Escrow      = Convert.ToDouble(marketOrderRow.Attributes["escrow"].InnerText, CultureInfo.InvariantCulture);
            marketItem.Price       = Convert.ToDouble(marketOrderRow.Attributes["price"].InnerText, CultureInfo.InvariantCulture);
            marketItem.Bid         = Convert.ToBoolean(Convert.ToInt32(marketOrderRow.Attributes["bid"].InnerText, CultureInfo.InvariantCulture), CultureInfo.InvariantCulture);
            marketItem.Issued      = TimeUtilities.ConvertCCPTimeStringToDateTimeUTC(marketOrderRow.Attributes["issued"].InnerText);
            marketItem.IssuedLocal = TimeUtilities.ConvertCCPToLocalTime(marketItem.Issued);
            if (marketItem.Bid)
            {
                marketItem.OrderType = MarketOrders.MarketOrderType.Buy;
            }
            else
            {
                marketItem.OrderType = MarketOrders.MarketOrderType.Sell;
            }

            return(marketItem);
        }