コード例 #1
0
        /// <summary>
        /// Store the specified API Character record in the database.
        /// </summary>
        /// <param name="apiChar"></param>
        public static void Store(APICharacter apiChar)
        {
            EMMADataSet.APICharactersDataTable table = new EMMADataSet.APICharactersDataTable();
            lock (apiCharTableAdapter)
            {
                EMMADataSet.APICharactersRow data = LoadCharFromDB(apiChar.CharID);

                bool newRow = false;

                if (data == null)
                {
                    newRow = true;

                    data = table.NewAPICharactersRow();
                    data.ID = apiChar.CharID;
                }
                data.CharSheet = apiChar.CharSheet.InnerXml;
                data.CorpSheet = apiChar.CorpSheet.InnerXml;
                data.LastCharSheetUpdate = apiChar.CharSheetXMLLastUpdate;
                data.LastCorpSheetUpdate = apiChar.CorpSheetXMLLastUpdate;
                data.LastCharAssetsUpdate = apiChar.GetLastAPIUpdateTime(CharOrCorp.Char, APIDataType.Assets);
                data.LastCharJournalUpdate = apiChar.GetLastAPIUpdateTime(CharOrCorp.Char, APIDataType.Journal);
                data.LastCharOrdersUpdate = apiChar.GetLastAPIUpdateTime(CharOrCorp.Char, APIDataType.Orders);
                data.LastCharTransUpdate = apiChar.GetLastAPIUpdateTime(CharOrCorp.Char, APIDataType.Transactions);
                data.LastCorpAssetsUpdate = apiChar.GetLastAPIUpdateTime(CharOrCorp.Corp, APIDataType.Assets);
                data.LastCorpJournalUpdate = apiChar.GetLastAPIUpdateTime(CharOrCorp.Corp, APIDataType.Journal);
                data.LastCorpOrdersUpdate = apiChar.GetLastAPIUpdateTime(CharOrCorp.Corp, APIDataType.Orders);
                data.LastCorpTransUpdate = apiChar.GetLastAPIUpdateTime(CharOrCorp.Corp, APIDataType.Transactions);
                data.CorpFinanceAccess = apiChar.CorpFinanceAccess;
                data.HighestCharJournalID = apiChar.GetHighestID(CharOrCorp.Char, APIDataType.Journal);
                data.HighestCharTransID = apiChar.GetHighestID(CharOrCorp.Char, APIDataType.Transactions);
                data.HighestCorpJournalID = apiChar.GetHighestID(CharOrCorp.Corp, APIDataType.Journal);
                data.HighestCorpTransID = apiChar.GetHighestID(CharOrCorp.Corp, APIDataType.Transactions);

                try
                {
                    if (newRow)
                    {
                        table.AddAPICharactersRow(data);
                        apiCharTableAdapter.Update(table);
                    }
                    else
                    {
                        apiCharTableAdapter.Update(data);
                    }
                }
                catch (Exception ex)
                {
                    throw new EMMADataException(ExceptionSeverity.Critical, "Error storing eve character " +
                        "data in the EMMA database.", ex);
                }
            }
        }
コード例 #2
0
        public UpdatePanel(CharOrCorp type, APICharacter character)
        {
            InitializeComponent();
            _type = type;
            _character = character;

            lblName.Text = "Update " + (type == CharOrCorp.Char ? _character.CharName : _character.CorpName) +
                " from API";

            lblJournal.BackColor = _upToDateColour;
            lblJournalStatus.BackColor = _upToDateColour;
            lblTransactions.BackColor = _upToDateColour;
            lblTransStatus.BackColor = _upToDateColour;
            lblOrders.BackColor = _upToDateColour;
            lblOrdersStatus.BackColor = _upToDateColour;
            lblAssets.BackColor = _upToDateColour;
            lblAssetsStatus.BackColor = _upToDateColour;
            lblIndustryJobs.BackColor = _upToDateColour;
            lblIndustryJobsStatus.BackColor = _upToDateColour;

            _showingTT.Add(APIDataType.Assets, false);
            _showingTT.Add(APIDataType.Journal, false);
            _showingTT.Add(APIDataType.Orders, false);
            _showingTT.Add(APIDataType.Transactions, false);
            _showingTT.Add(APIDataType.IndustryJobs, false);
            _lastUpdateAttempt.Add(APIDataType.Assets, DateTime.MinValue);
            _lastUpdateAttempt.Add(APIDataType.Journal, DateTime.MinValue);
            _lastUpdateAttempt.Add(APIDataType.Orders, DateTime.MinValue);
            _lastUpdateAttempt.Add(APIDataType.Transactions, DateTime.MinValue);
            _lastUpdateAttempt.Add(APIDataType.IndustryJobs, DateTime.MinValue);

            _individualUpdate = UserAccount.Settings.APIIndividualUpdate;

            RefreshCheckboxDisplay();

            if (type == CharOrCorp.Char)
            {
                picPortrait.Image = Portaits.GetPortrait(character.CharID);
                lblCorpTag.Visible = false;
            }
            else
            {
                picPortrait.Image = null;
                picPortrait.BorderStyle = BorderStyle.FixedSingle;
                lblCorpTag.Visible = true;
                lblCorpTag.Text = "[" + character.CorpTag + "]";

                // Get any other characters in the group with the same corp.
                List<APICharacter> otherCorpChars = new List<APICharacter>();
                foreach (EVEAccount account in UserAccount.CurrentGroup.Accounts)
                {
                    foreach (APICharacter tmpchar in account.Chars)
                    {
                        if (tmpchar.CharID != _character.CharID && tmpchar.CorpID == _character.CorpID)
                        {
                            otherCorpChars.Add(tmpchar);
                        }
                    }
                }
                otherCorpChars.Add(_character);
                _character.OtherCorpChars = otherCorpChars;
            }

            _toggleAll = !chkAutoTrans.Checked && !chkAutoOrders.Checked && !chkAutoJournal.Checked && !chkAutoAssets.Checked;

            chkUpdate.Enabled = !Globals.EveAPIDown;
            chkAutoAssets.Enabled = !Globals.EveAPIDown;
            chkAutoJournal.Enabled = !Globals.EveAPIDown;
            chkAutoOrders.Enabled = !Globals.EveAPIDown;
            chkAutoTrans.Enabled = !Globals.EveAPIDown;

            chkAutoAssets.Tag = APIDataType.Assets;
            chkAutoIndustryJobs.Tag = APIDataType.IndustryJobs;
            chkAutoJournal.Tag = APIDataType.Journal;
            chkAutoOrders.Tag = APIDataType.Orders;
            chkAutoTrans.Tag = APIDataType.Transactions;
            chkAutoAssets.CheckedChanged += new EventHandler(chk_CheckedChanged);
            chkAutoJournal.CheckedChanged += new EventHandler(chk_CheckedChanged);
            chkAutoOrders.CheckedChanged += new EventHandler(chk_CheckedChanged);
            chkAutoTrans.CheckedChanged += new EventHandler(chk_CheckedChanged);
            chkAutoIndustryJobs.CheckedChanged += new EventHandler(chk_CheckedChanged);

            lblAssets.Tag = new LabelMetaData(APIDataType.Assets);
            lblAssetsStatus.Tag = new LabelMetaData(APIDataType.Assets);
            lblJournal.Tag = new LabelMetaData(APIDataType.Journal);
            lblJournalStatus.Tag = new LabelMetaData(APIDataType.Journal);
            lblOrders.Tag = new LabelMetaData(APIDataType.Orders);
            lblOrdersStatus.Tag = new LabelMetaData(APIDataType.Orders);
            lblTransactions.Tag = new LabelMetaData(APIDataType.Transactions);
            lblTransStatus.Tag =new LabelMetaData( APIDataType.Transactions);
            lblIndustryJobs.Tag = new LabelMetaData(APIDataType.IndustryJobs);
            lblIndustryJobsStatus.Tag = new LabelMetaData(APIDataType.IndustryJobs);

            lblAssets.MouseHover += new EventHandler(Label_MouseHover);
            lblAssetsStatus.MouseHover += new EventHandler(Label_MouseHover);
            lblJournal.MouseHover += new EventHandler(Label_MouseHover);
            lblJournalStatus.MouseHover += new EventHandler(Label_MouseHover);
            lblOrders.MouseHover += new EventHandler(Label_MouseHover);
            lblOrdersStatus.MouseHover += new EventHandler(Label_MouseHover);
            lblTransactions.MouseHover += new EventHandler(Label_MouseHover);
            lblTransStatus.MouseHover += new EventHandler(Label_MouseHover);
            lblIndustryJobs.MouseHover += new EventHandler(Label_MouseHover);
            lblIndustryJobsStatus.MouseHover += new EventHandler(Label_MouseHover);

            lblAssets.MouseLeave += new EventHandler(Label_MouseLeave);
            lblAssetsStatus.MouseLeave += new EventHandler(Label_MouseLeave);
            lblJournal.MouseLeave += new EventHandler(Label_MouseLeave);
            lblJournalStatus.MouseLeave += new EventHandler(Label_MouseLeave);
            lblOrders.MouseLeave += new EventHandler(Label_MouseLeave);
            lblOrdersStatus.MouseLeave += new EventHandler(Label_MouseLeave);
            lblTransactions.MouseLeave += new EventHandler(Label_MouseLeave);
            lblTransStatus.MouseLeave += new EventHandler(Label_MouseLeave);
            lblIndustryJobs.MouseLeave += new EventHandler(Label_MouseLeave);
            lblIndustryJobsStatus.MouseLeave += new EventHandler(Label_MouseLeave);

            // Removed this because it causes the update to run before the creating
            // proceedure has had a chance to attach it's event listeners..
            //UpdateData();
        }
コード例 #3
0
        /// <summary>
        /// Populate the List of APICharacters with entries based upon the data in the _charList
        /// XML document.
        /// </summary>
        public void PopulateChars()
        {
            if (_charList != null)
            {
                _chars = new List<APICharacter>();

                try
                {
                    CharOrCorp accessType;
                    XmlNodeList results = EveAPI.GetResults(_charList,true);

                    foreach (XmlNode node in results)
                    {
                        accessType = node.SelectSingleNode("@type").Value.ToString() == "Character" ||
                            node.SelectSingleNode("@type").Value.ToString() == "Account" ? CharOrCorp.Char : CharOrCorp.Corp;

                        foreach (XmlNode node2 in node.SelectNodes("rowset/row"))
                        {
                            APICharacter apiChar = APICharacters.GetCharacter(_userID, _apiKey,
                                int.Parse(node2.SelectSingleNode("@characterID").Value.ToString()));
                            if (apiChar == null)
                            {
                                // Need to create a new API char in the database.
                                apiChar = new APICharacter(_userID, _apiKey, accessType,
                                    long.Parse(node2.SelectSingleNode("@characterID").Value.ToString()));
                                APICharacters.Store(apiChar);
                            }
                            apiChar.AccessType = accessType;
                            _chars.Add(apiChar);
                        }
                    }
                }
                catch (EMMAEveAPIException) { }
            }
        }
コード例 #4
0
 public CharCorp(APICharacter charObj, bool corp)
 {
     characterObj = charObj;
     this.corp = corp;
 }
コード例 #5
0
 public CharCorpOption(APICharacter characterObj, bool corp)
 {
     _data = new CharCorp(characterObj, corp);
 }
コード例 #6
0
        private void ExportTransactionXML(string dir, APICharacter character, bool forCorp)
        {
            int wallet = 1000;
            int maxWallet = !forCorp ? 1000 : 1007;

            while (wallet <= maxWallet)
            {
                string filename = Path.Combine(dir, (!forCorp ? character.CharName : character.CorpName) + " [" +
                    (!forCorp ? character.CharID : character.CorpID) + "]" + (!forCorp ? "" : " Wallet " + wallet) + " Transactions.xml");
                EveMarketMonitorApp.DatabaseClasses.EMMADataSet.TransactionsDataTable transactions = Transactions.GetTransData(character.CharID, forCorp, 0, 0, 0, 0, "");

                XmlDocument xml = new XmlDocument();

                XmlNode eveAPINode = xml.CreateNode(XmlNodeType.Element, "eveapi", "");
                XmlAttribute versionNode = xml.CreateAttribute("version", "");
                versionNode.Value = "2";
                eveAPINode.Attributes.Append(versionNode);

                XmlNode currentTimeNode = xml.CreateNode(XmlNodeType.Element, "currentTime", "");
                currentTimeNode.InnerText = DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture);
                eveAPINode.AppendChild(currentTimeNode);

                XmlNode resultNode = xml.CreateNode(XmlNodeType.Element, "result", "");
                XmlNode rootRowSetNode = AddTransactionsToXML(xml, transactions, !forCorp ? character.CharID : character.CorpID, forCorp, wallet);
                resultNode.AppendChild(rootRowSetNode);
                eveAPINode.AppendChild(resultNode);

                xml.AppendChild(eveAPINode);
                xml.Save(filename);

                wallet++;
            }
        }
コード例 #7
0
        private void ExportMarketOrderXML(string dir, APICharacter character, bool forCorp)
        {
            string filename = Path.Combine(dir, (!forCorp ? character.CharName : character.CorpName) + " [" +
                    (!forCorp ? character.CharID : character.CorpID) + "]" + " MarketOrders.xml");
                List<AssetAccessParams> accessParams = new List<AssetAccessParams>();
                if (!forCorp)
                {
                    accessParams.Add(new AssetAccessParams(character.CharID));
                }
                else
                {
                    accessParams.Add(new AssetAccessParams(character.CorpID));
                }
                EveMarketMonitorApp.DatabaseClasses.EMMADataSet.OrdersDataTable marketOrders = Orders.LoadOrdersData(accessParams, new List<int>(), new List<long>(), 0, "");

                XmlDocument xml = new XmlDocument();

                XmlNode eveAPINode = xml.CreateNode(XmlNodeType.Element, "eveapi", "");
                XmlAttribute versionNode = xml.CreateAttribute("version", "");
                versionNode.Value = "2";
                eveAPINode.Attributes.Append(versionNode);

                XmlNode currentTimeNode = xml.CreateNode(XmlNodeType.Element, "currentTime", "");
                currentTimeNode.InnerText = DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture);
                eveAPINode.AppendChild(currentTimeNode);

                XmlNode resultNode = xml.CreateNode(XmlNodeType.Element, "result", "");
                XmlNode rootRowSetNode = AddMarketOrderToXML(xml, marketOrders);
                resultNode.AppendChild(rootRowSetNode);
                eveAPINode.AppendChild(resultNode);

                xml.AppendChild(eveAPINode);
                xml.Save(filename);
        }
コード例 #8
0
        private void ExportJournalXML(string dir, APICharacter character, bool forCorp)
        {
            short wallet = 1000;
            int maxWallet = !forCorp ? 1000 : 1007;

            while (wallet <= maxWallet)
            {
                string filename = Path.Combine(dir, (!forCorp ? character.CharName : character.CorpName) + " [" +
                    (!forCorp ? character.CharID : character.CorpID) + "]" + (!forCorp ? "" : " Wallet " + wallet) + " Journal.xml");
                List<FinanceAccessParams> accessParams = new List<FinanceAccessParams>();
                if (!forCorp)
                {
                    accessParams.Add(new FinanceAccessParams(character.CharID));
                }
                else
                {
                    accessParams.Add(new FinanceAccessParams(character.CorpID, new List<short>() { wallet }));
                }
                EveMarketMonitorApp.DatabaseClasses.EMMADataSet.JournalDataTable journalEntries = Journal.LoadEntriesData(
                    accessParams, new List<short>(), DateTime.MinValue, DateTime.MaxValue, null);

                XmlDocument xml = new XmlDocument();

                XmlNode eveAPINode = xml.CreateNode(XmlNodeType.Element, "eveapi", "");
                XmlAttribute versionNode = xml.CreateAttribute("version", "");
                versionNode.Value = "2";
                eveAPINode.Attributes.Append(versionNode);

                XmlNode currentTimeNode = xml.CreateNode(XmlNodeType.Element, "currentTime", "");
                currentTimeNode.InnerText = DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture);
                eveAPINode.AppendChild(currentTimeNode);

                XmlNode resultNode = xml.CreateNode(XmlNodeType.Element, "result", "");
                XmlNode rootRowSetNode = AddJournalToXML(xml, journalEntries, !forCorp ? character.CharID : character.CorpID, forCorp, wallet);
                resultNode.AppendChild(rootRowSetNode);
                eveAPINode.AppendChild(resultNode);

                xml.AppendChild(eveAPINode);
                xml.Save(filename);

                wallet++;
            }
        }
コード例 #9
0
        private void ExportIndustryJobXML(string dir, APICharacter character)
        {
            string filename = Path.Combine(dir, character.CharName + " [" +
                character.CharID + "]" + " IndustryJobs.xml");
            EMMADataSet.IndustryJobsDataTable industryJobs = IndustryJobs.GetJobs();

            XmlDocument xml = new XmlDocument();

            XmlNode eveAPINode = xml.CreateNode(XmlNodeType.Element, "eveapi", "");
            XmlAttribute versionNode = xml.CreateAttribute("version", "");
            versionNode.Value = "2";
            eveAPINode.Attributes.Append(versionNode);

            XmlNode currentTimeNode = xml.CreateNode(XmlNodeType.Element, "currentTime", "");
            currentTimeNode.InnerText = DateTime.UtcNow.ToString("s", System.Globalization.CultureInfo.InvariantCulture);
            eveAPINode.AppendChild(currentTimeNode);

            XmlNode resultNode = xml.CreateNode(XmlNodeType.Element, "result", "");
            XmlNode rootRowSetNode = AddIndustryJobsToXML(xml, industryJobs.Where(j => j.InstallerID == character.CharID));
            resultNode.AppendChild(rootRowSetNode);
            eveAPINode.AppendChild(resultNode);

            xml.AppendChild(eveAPINode);
            xml.Save(filename);
        }
コード例 #10
0
        // Note - cannot export these contracts as they don't have half the data needed.
        // when I put them in EMMA there was no contracts API so all the data in EMMA has been
        // entered by users and it's just not enough for EMMA 2 to work with.
        private void ExportContractsXML(string dir, APICharacter character, bool forCorp)
        {
            string filename = Path.Combine(dir, (!forCorp ? character.CharName : character.CorpName) + " [" +
                (!forCorp ? character.CharID : character.CorpID) + "]" + " Contracts.xml");
            List<long> ownerIDs  = new List<long>();
            if (!forCorp){  ownerIDs.Add(character.CharID);}
            else{ ownerIDs.Add(character.CorpID);}
            ContractList contracts = Contracts.GetContracts(ownerIDs, 0, 0, 0, ContractType.Any);

            XmlDocument xml = new XmlDocument();

            XmlNode eveAPINode = xml.CreateNode(XmlNodeType.Element, "eveapi", "");
            XmlAttribute versionNode = xml.CreateAttribute("version", "");
            versionNode.Value = "2";
            eveAPINode.Attributes.Append(versionNode);

            XmlNode currentTimeNode = xml.CreateNode(XmlNodeType.Element, "currentTime", "");
            currentTimeNode.InnerText = DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss");
            eveAPINode.AppendChild(currentTimeNode);

            XmlNode resultNode = xml.CreateNode(XmlNodeType.Element, "result", "");
            XmlNode rootRowSetNode = AddContractsToXML(xml, contracts);
            resultNode.AppendChild(rootRowSetNode);
            eveAPINode.AppendChild(resultNode);

            xml.AppendChild(eveAPINode);
            xml.Save(filename);
        }