Exemplo n.º 1
0
        /// <summary>
        /// Imports data from an API serialization object provided by CCP.
        /// </summary>
        /// <param name="serial"></param>
        internal void Import(SerializableAPICharacterSheet serial)
        {
            if (serial == null)
            {
                return;
            }

            // Import the active clone implants
            ActiveClone.Import(serial.Implants);

            m_cloneSets.Clear();
            foreach (SerializableCharacterJumpClone jumpClone in serial.JumpClones)
            {
                List <SerializableNewImplant> cloneImplants =
                    serial.JumpCloneImplants.Where(x => x.JumpCloneID == jumpClone.JumpCloneID)
                    .Select(cloneImplant => new SerializableNewImplant
                {
                    ID   = cloneImplant.TypeID,
                    Name = cloneImplant.TypeName
                }).ToList();

                ImplantSet set = new ImplantSet(m_character, jumpClone.CloneName);
                set.Import(cloneImplants);
                m_cloneSets.Add(set);
            }

            EveMonClient.OnCharacterImplantSetCollectionChanged(m_character);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Imports data from the given character sheet informations
        /// </summary>
        /// <param name="serial">The serialized character sheet</param>
        protected void Import(SerializableAPICharacterSheet serial)
        {
            Import((SerializableCharacterSheetBase)serial);

            // Implants
            m_implants.Import(serial.Implants);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Query this method with the provided HTTP POST data
        /// </summary>
        /// <typeparam name="T">The subtype to deserialize (the deserialized type being <see cref="APIResult{T}"/>).</typeparam>
        /// <param name="method">The method to query</param>
        /// <param name="postData">The http POST data</param>
        /// <param name="transform">The XSL transform to apply, may be null.</param>
        /// <returns>The deserialized object</returns>
        private APIResult <T> QueryMethod <T>(APIMethods method, HttpPostData postData, XslCompiledTransform transform)
        {
            // Download
            string url    = GetMethodUrl(method);
            var    result = Util.DownloadAPIResult <T>(url, postData, transform);

            // On failure with a custom method, fallback to CCP
            if (ShouldRetryWithCCP(result))
            {
                return(s_ccpProvider.QueryMethod <T>(method, postData, transform));
            }

            // If the result is a character sheet, we store the result
            if (method == APIMethods.CharacterSheet && !result.HasError)
            {
                SerializableAPICharacterSheet sheet = (SerializableAPICharacterSheet)(Object)result.Result;
                LocalXmlCache.Save(sheet.Name, result.XmlDocument);
            }

            // If the result is a conquerable station list, we store the result
            if (method == APIMethods.ConquerableStationList && !result.HasError)
            {
                LocalXmlCache.Save(method.ToString(), result.XmlDocument);
            }

            // Returns
            return(result);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Imports data from the given character sheet informations.
 /// </summary>
 /// <param name="serial">The serialized character sheet</param>
 private void Import(SerializableAPICharacterSheet serial)
 {
     Import((SerializableCharacterSheetBase)serial);
     // Implants
     if (serial.Implants.Any() || serial.JumpClones.Any())
     {
         ImplantSets.Import(serial);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Asynchrnoneously queries this method with the provided HTTP POST data
        /// </summary>
        /// <typeparam name="T">The subtype to deserialize (the deserialized type being <see cref="APIResult{T}"/>).</typeparam>
        /// <param name="method">The method to query</param>
        /// <param name="postData">The http POST data</param>
        /// <param name="callback">The callback to invoke once the query has been completed. It will be done on the data actor (see <see cref="DataObject.CommonActor"/>).</param>
        /// <param name="transform">The XSL transform to apply, may be null.</param>
        private void QueryMethodAsync <T>(APIMethods method, HttpPostData postData, XslCompiledTransform transform, QueryCallback <T> callback)
        {
            // Check callback not null
            if (callback == null)
            {
                throw new ArgumentNullException("The callback cannot be null.", "callback");
            }

            // Lazy download
            string url = GetMethodUrl(method);

            Util.DownloadAPIResultAsync <T>(url, postData, transform, (result) =>
            {
                // On failure with a custom method, fallback to CCP
                if (ShouldRetryWithCCP(result))
                {
                    result = s_ccpProvider.QueryMethod <T>(method, postData, transform);
                }

                // If the result is a character sheet, we store the result
                if (method == APIMethods.CharacterSheet && !result.HasError)
                {
                    SerializableAPICharacterSheet sheet = (SerializableAPICharacterSheet)(Object)result.Result;
                    LocalXmlCache.Save(sheet.Name, result.XmlDocument);
                }

                // If the result is a conquerable station list, we store the result
                if (method == APIMethods.ConquerableStationList && !result.HasError)
                {
                    LocalXmlCache.Save(method.ToString(), result.XmlDocument);
                }

                // Invokes the callback
                callback(result);
            });
        }