Пример #1
0
        public APICharacter(long userID, string apiKey, CharOrCorp accessType, long charID)
        {
            _userID = userID;
            _apiKey = apiKey;
            _charID = charID;
            _accessType = accessType;
            _apiSettings = new APISettingsAndStatus(_charID);

            if (accessType == CharOrCorp.Char)
            {
                try
                {
                    RefreshCharXMLFromAPI();
                }
                catch { }
            }
            else
            {
                try
                {
                    RefreshCorpXMLFromAPI();
                }
                catch { }
            }

            if (!Settings.UpdatedOwnerIDToCorpID)
            {
                UpdateOwnerIDToCorpID();
            }
        }
Пример #2
0
        public APICharacter(long userID, string apiKey, CharOrCorp accessType, EMMADataSet.APICharactersRow data)
        {
            _userID = userID;
            _apiKey = apiKey;
            _charID = data.ID;
            _apiSettings = new APISettingsAndStatus(_charID);
            if (data.CharSheet.Length > 0)
            {
                _charSheetXMLCache.LoadXml(data.CharSheet);
                _charSheetXMLLastUpdate = data.LastCharSheetUpdate;
                GetDataFromCharXML();
            }
            if (data.CorpSheet.Length > 0)
            {
                _corpSheetXMLCache.LoadXml(data.CorpSheet);
                _corpSheetXMLLastUpdate = data.LastCorpSheetUpdate;
                GetDataFromCorpXML();
            }

            _corpFinanceAccess = data.CorpFinanceAccess;

            if (accessType == CharOrCorp.Char)
            {
                try
                {
                    RefreshCharXMLFromAPI();
                }
                catch { }
            }
            else
            {
                try
                {
                    RefreshCorpXMLFromAPI();
                }
                catch { }
            }

            SetLastAPIUpdateTime(CharOrCorp.Char, APIDataType.Assets, data.LastCharAssetsUpdate);
            SetLastAPIUpdateTime(CharOrCorp.Char, APIDataType.Journal, data.LastCharJournalUpdate);
            SetLastAPIUpdateTime(CharOrCorp.Char, APIDataType.Orders, data.LastCharOrdersUpdate);
            SetLastAPIUpdateTime(CharOrCorp.Char, APIDataType.Transactions, data.LastCharTransUpdate);
            SetLastAPIUpdateTime(CharOrCorp.Corp, APIDataType.Assets, data.LastCorpAssetsUpdate);
            SetLastAPIUpdateTime(CharOrCorp.Corp, APIDataType.Journal, data.LastCorpJournalUpdate);
            SetLastAPIUpdateTime(CharOrCorp.Corp, APIDataType.Orders, data.LastCorpOrdersUpdate);
            SetLastAPIUpdateTime(CharOrCorp.Corp, APIDataType.Transactions, data.LastCorpTransUpdate);
            // Note - don't need to set industry job update dates as they are stored in the settings xml
            // instead of directly on the character record.

            SetHighestID(CharOrCorp.Char, APIDataType.Transactions, data.HighestCharTransID);
            SetHighestID(CharOrCorp.Corp, APIDataType.Transactions, data.HighestCorpTransID);
            SetHighestID(CharOrCorp.Char, APIDataType.Journal, data.HighestCharJournalID);
            SetHighestID(CharOrCorp.Corp, APIDataType.Journal, data.HighestCorpJournalID);

            if (!Settings.UpdatedOwnerIDToCorpID)
            {
                UpdateOwnerIDToCorpID();
            }
        }