コード例 #1
0
ファイル: EveAssets.cs プロジェクト: Blessvk/EveRefinery
        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);
        }
コード例 #2
0
        private void BtnLoadSkills_Click(object sender, EventArgs e)
        {
            if (null == CmbLoadSkills.SelectedItem)
            {
                return;
            }

            UInt32 userID = TextItemWithUInt32.GetData(CmbLoadSkills.SelectedItem);

            Settings.V1._ApiKey apiKey = Engine.GetCharacterKey(m_Settings, userID);
            if (null == apiKey)
            {
                ErrorMessageBox.Show("Can't find API key for selected character");
                return;
            }

            Dictionary <UInt32, UInt32> skills = new Dictionary <UInt32, UInt32>();

            if (!LoadSkills(apiKey, userID, skills))
            {
                return;
            }

            EveSkills[] skillIDs = (EveSkills[])Enum.GetValues(typeof(EveSkills));
            foreach (EveSkills currSkill in skillIDs)
            {
                UInt32 skillLevel = 0;
                if (skills.ContainsKey((UInt32)currSkill))
                {
                    skillLevel = skills[(UInt32)currSkill];
                }

                m_Settings.Refining.Skills[(UInt32)currSkill] = skillLevel;
            }

            PrpRefining.Refresh();
        }