Beispiel #1
0
        private bool LoadSkills(Settings.V1._ApiKey a_ApiKey, UInt32 a_UserID, Dictionary <UInt32, UInt32> a_Result)
        {
            String      errorHeader = "Failed to load skills";
            XmlDocument xmlReply    = EveApi.MakeRequest("char/CharacterSheet.xml.aspx", a_ApiKey, a_UserID, errorHeader);

            if (null == xmlReply)
            {
                return(false);
            }

            try
            {
                XmlNodeList skillNodes = xmlReply.SelectNodes("/eveapi/result/rowset[@name='skills']/row");
                foreach (XmlNode currNode in skillNodes)
                {
                    UInt32 typeID = UInt32.Parse(currNode.Attributes["typeID"].Value);
                    UInt32 level  = UInt32.Parse(currNode.Attributes["level"].Value);
                    a_Result[typeID] = level;
                }
            }
            catch (System.Exception a_Exception)
            {
                ErrorMessageBox.Show(errorHeader + ":\n" + "Failed to parse EVE API reply:\n" + a_Exception.Message);
                return(false);
            }

            // Safety check for possible XML format change
            if (0 == a_Result.Count)
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        private void UpdateSingleUser(string a_KeyID, string a_Verification)
        {
            Settings.V1._ApiKey tempKey = new Settings.V1._ApiKey();
            UInt32.TryParse(a_KeyID, out tempKey.KeyID);
            tempKey.Verification = a_Verification;

            string      errorHeader = "Failed to update user " + a_KeyID;
            XmlDocument xmlReply    = EveApi.MakeRequest("account/Characters.xml.aspx", tempKey, 0, errorHeader);

            if (null == xmlReply)
            {
                return;
            }

            XmlNodeList characterNodes = xmlReply.GetElementsByTagName("row");

            if (0 == characterNodes.Count)
            {
                ErrorMessageBox.Show(errorHeader + "No characters found");
                return;
            }

            DeleteCharactersFromUser(a_KeyID);

            foreach (XmlNode characterNode in characterNodes)
            {
                ListViewItem newItem = LstCharacters.Items.Add(a_KeyID);
                newItem.SubItems.Add(characterNode.Attributes["characterID"].Value);
                newItem.SubItems.Add(characterNode.Attributes["name"].Value);
                newItem.SubItems.Add(characterNode.Attributes["corporationName"].Value);
            }
        }
Beispiel #3
0
        public Boolean LoadAssets(UInt32 a_CharID)
        {
            string assetsCachePath = GetAssetsCacheFilePath(a_CharID);

            try
            {
                if (LoadAssetsXml(assetsCachePath, true))
                {
                    return(true);
                }
            }
            catch (System.Exception a_Exception)
            {
                System.Diagnostics.Debug.WriteLine(a_Exception.Message);
            }

            Settings.V1._ApiKey apiKey = m_Engine.GetCharacterKey(a_CharID);
            if (null == apiKey)
            {
                return(false);
            }

            string      errorHeader = "Failed to update assets";
            XmlDocument assetsXml   = EveApi.MakeRequest("char/AssetList.xml.aspx", apiKey, a_CharID, errorHeader);

            if (null == assetsXml)
            {
                return(false);
            }

            ParseAssetsXML(assetsXml);

            // Ignore saving errors
            try
            {
                assetsXml.Save(assetsCachePath);
            }
            catch (System.Exception a_Exception)
            {
                System.Diagnostics.Debug.WriteLine(a_Exception.Message);
            }

            return(true);
        }
Beispiel #4
0
        private void                    UpdateFromApi()
        {
            string      errorHeader = "Failed to load outpost information from EVE API";
            XmlDocument xml         = EveApi.MakeRequest("eve/ConquerableStationList.xml.aspx", null, 0, errorHeader);

            if (null == xml)
            {
                return;
            }

            try
            {
                xml.Save(GetCacheFilePath());
                ParseXml(xml);
            }
            catch (System.Exception a_Exception)
            {
                System.Diagnostics.Debug.WriteLine(a_Exception.Message);
            }
        }