예제 #1
0
        private void GetMarketOrders()
        {
            Display("Retrieving market orders.");
            StringBuilder sb = new StringBuilder();

            CCPAPIInterfacer[] w = new CCPAPIInterfacer[_totalcharacters];
            // build URL list
            // make requests
            int count = 0;

            try
            {
                foreach (Account a in _eveaccounts)
                {
                    foreach (Character c in a)
                    {
                        w[count] = new CCPAPIInterfacer(c);
                        sb.Append(_baseurl).Append(_marketordersendpoint)
                        .Append("?keyid=").Append(a.KeyID)
                        .Append("&vcode=").Append(a.VCode)
                        .Append("&characterid=").Append(c.CharacterID);
                        w[count].AssociatedCharacter      = c;
                        w[count].DownloadStringCompleted += w_MarketOrderEndpointResponse;
                        w[count].DownloadStringAsync(new Uri(sb.ToString()));
                        sb.Clear();
                        ++count;
                    }
                }
            }
            catch (Exception) { }

            while (_marketorderendpointresponses.Count != _totalcharacters)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving market orders {0} of {1}.", _marketorderendpointresponses.Count, _totalcharacters);
                Thread.Sleep(1);
            }

            foreach (Account a in _eveaccounts)
            {
                foreach (Character c in a)
                {
                    foreach (XmlDocument doc in _marketorderendpointresponses)
                    {
                        string charid = doc.SelectSingleNode("/eveapi/characterid").InnerText;
                        if (c.CharacterID.Equals(charid))
                        {
                            c.MarketOrdersXML = doc;
                        }
                    }
                }
            }
        }
예제 #2
0
        private void GetAccountBalances()
        {
            Display("Retrieving account balances.");
            StringBuilder sb = new StringBuilder();

            CCPAPIInterfacer[] w = new CCPAPIInterfacer[_totalcharacters];
            int count            = 0;

            try
            {
                foreach (Account a in _eveaccounts)
                {
                    foreach (Character c in a)
                    {
                        w[count] = new CCPAPIInterfacer(c);
                        sb.Append(_baseurl).Append(_accountbalanceendpoint)
                        .Append("?keyid=").Append(a.KeyID)
                        .Append("&vcode=").Append(a.VCode)
                        .Append("&characterid=").Append(c.CharacterID);
                        w[count].AssociatedCharacter      = c;
                        w[count].DownloadStringCompleted += w_AccountBalanceEndpointResponse;
                        w[count].DownloadStringAsync(new Uri(sb.ToString()));
                        sb.Clear();
                        ++count;
                    }
                }
            }
            catch (Exception) { }

            while (_accountbalanceresponses.Count != _totalcharacters)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving account balances {0} of {1}.", _accountbalanceresponses.Count, _totalcharacters);
                Thread.Sleep(1);
            }

            foreach (Account a in _eveaccounts)
            {
                foreach (Character c in a)
                {
                    foreach (XmlDocument doc in _accountbalanceresponses)
                    {
                        string charid = doc.SelectSingleNode("/eveapi/characterid").InnerText;
                        if (c.CharacterID.Equals(charid))
                        {
                            c.ISK = Convert.ToDecimal(doc.SelectSingleNode("/eveapi/result/rowset/row").Attributes["balance"].Value);
                        }
                    }
                }
            }

            _accountbalanceresponses.Clear();
        }
예제 #3
0
        /***********************************************************************
        *
        * RETRIEVAL FUNCTIONS
        *
        ***********************************************************************/

        private void GetAccountXML()
        {
            Display("Retrieving characters.");
            StringBuilder sb = new StringBuilder();

            CCPAPIInterfacer[] w = new CCPAPIInterfacer[3];

            try
            {
                for (int i = 0; i < _eveaccounts.Count; ++i)
                {
                    w[i] = new CCPAPIInterfacer(_eveaccounts[i]);
                    w[i].DownloadStringCompleted += w_AccountEndpointResponse;
                    sb.Append(_baseurl).Append(_accountendpoint).Append("?keyid=").Append(_eveaccounts[i].KeyID)
                    .Append("&vcode=").Append(_eveaccounts[i].VCode);
                    w[i].DownloadStringAsync(new Uri(sb.ToString()));
                    sb.Clear();
                }
            }
            catch (Exception) { }

            while (_accountendpointresponses.Count != _eveaccounts.Count)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving characters {0} of {1}.", _accountendpointresponses.Count, _eveaccounts.Count);
                Thread.Sleep(1);
            }

            foreach (Account a in _eveaccounts)
            {
                foreach (XmlDocument doc in _accountendpointresponses)
                {
                    string keyid = doc.SelectSingleNode("/eveapi/keyid").InnerText;
                    if (a.KeyID.Equals(keyid))
                    {
                        foreach (XmlNode node in doc.SelectNodes("/eveapi/result/rowset/row"))
                        {
                            string name   = node.Attributes["name"].Value;
                            string charid = node.Attributes["characterID"].Value;
                            a.Add(new Character(name, charid));
                        }
                    }
                }
            }

            _accountendpointresponses.Clear();
        }
예제 #4
0
        private void GetContractHeaders()
        {
            Display("Retrieving contract headers.");
            StringBuilder sb = new StringBuilder();

            CCPAPIInterfacer[] w = new CCPAPIInterfacer[_totalcharacters];

            int count = 0;

            try
            {
                foreach (Account a in _eveaccounts)
                {
                    foreach (Character c in a)
                    {
                        w[count] = new CCPAPIInterfacer(c);
                        sb.Append(_baseurl).Append(_contractsendpoint)
                        .Append("?keyid=").Append(a.KeyID)
                        .Append("&vcode=").Append(a.VCode)
                        .Append("&characterid=").Append(c.CharacterID);
                        w[count].AssociatedCharacter      = c;
                        w[count].DownloadStringCompleted += w_ContractsEndpointResponse;
                        w[count].DownloadStringAsync(new Uri(sb.ToString()));
                        sb.Clear();
                        ++count;
                    }
                }
            }
            catch (Exception) { }

            while (_contractheaders.Count != _totalcharacters)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving contract headers {0} of {1}.", _contractheaders.Count, _totalcharacters);
                Thread.Sleep(1);
            }
        }
예제 #5
0
        private void GetContractContents()
        {
            Display("Retrieving contract items.");
            List <string> issuersandcontractheaders = new List <string>();

            foreach (XmlDocument x in _contractheaders)
            {
                foreach (XmlNode n in x.SelectNodes("/eveapi/result/rowset/row"))
                {
                    if (n.Attributes["status"].Value.Equals("Outstanding"))
                    {
                        string issuer     = n.Attributes["issuerID"].Value;
                        string contractid = n.Attributes["contractID"].Value;
                        issuersandcontractheaders.Add(issuer + "," + contractid);
                    }
                }
            }
            int requests = issuersandcontractheaders.Count;

            try
            {
                if (requests > 0)
                {
                    StringBuilder      sb = new StringBuilder();
                    CCPAPIInterfacer[] w  = new CCPAPIInterfacer[requests];

                    int count = 0;
                    foreach (var item in issuersandcontractheaders)
                    {
                        foreach (Account a in _eveaccounts)
                        {
                            foreach (Character c in a)
                            {
                                if (item.Split(',')[0].Equals(c.CharacterID))
                                {
                                    w[count] = new CCPAPIInterfacer(c);
                                    sb.Append(_baseurl).Append(_contractitemsendpoint)
                                    .Append("?keyid=").Append(a.KeyID)
                                    .Append("&vcode=").Append(a.VCode)
                                    .Append("&characterid=").Append(c.CharacterID)
                                    .Append("&contractid=").Append(item.Split(',')[1]);
                                    w[count].AssociatedCharacter      = c;
                                    w[count].DownloadStringCompleted += w_ContractItemsEndpointResponse;
                                    w[count].DownloadStringAsync(new Uri(sb.ToString()));
                                    sb.Clear();
                                    ++count;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception) { }

            while (_contractitems.Count != requests)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving contract items {0} of {1}.", _contractitems.Count, requests);
                Thread.Sleep(1);
            }

            foreach (Account a in _eveaccounts)
            {
                foreach (Character c in a)
                {
                    foreach (XmlDocument doc in _contractitems)
                    {
                        string charid = doc.SelectSingleNode("/eveapi/characterid").InnerText;
                        if (c.CharacterID.Equals(charid))
                        {
                            c.ContractItemsXML = doc;
                        }
                    }
                }
            }
        }
        private void GetContractContents()
        {
            Display("Retrieving contract items.");
            List<string> issuersandcontractheaders = new List<string>();
            foreach (XmlDocument x in _contractheaders)
            {
                foreach (XmlNode n in x.SelectNodes("/eveapi/result/rowset/row"))
                {
                    if (n.Attributes["status"].Value.Equals("Outstanding"))
                    {
                        string issuer = n.Attributes["issuerID"].Value;
                        string contractid = n.Attributes["contractID"].Value;
                        issuersandcontractheaders.Add(issuer + "," + contractid);
                    }
                }
            }
            int requests = issuersandcontractheaders.Count;

            try
            {
                if (requests > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    CCPAPIInterfacer[] w = new CCPAPIInterfacer[requests];

                    int count = 0;
                    foreach (var item in issuersandcontractheaders)
                    {
                        foreach (Account a in _eveaccounts)
                        {
                            foreach (Character c in a)
                            {
                                if (item.Split(',')[0].Equals(c.CharacterID))
                                {
                                    w[count] = new CCPAPIInterfacer(c);
                                    sb.Append(_baseurl).Append(_contractitemsendpoint)
                                        .Append("?keyid=").Append(a.KeyID)
                                        .Append("&vcode=").Append(a.VCode)
                                        .Append("&characterid=").Append(c.CharacterID)
                                        .Append("&contractid=").Append(item.Split(',')[1]);
                                    w[count].AssociatedCharacter = c;
                                    w[count].DownloadStringCompleted += w_ContractItemsEndpointResponse;
                                    w[count].DownloadStringAsync(new Uri(sb.ToString()));
                                    sb.Clear();
                                    ++count;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception) { }

            while (_contractitems.Count != requests)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving contract items {0} of {1}.", _contractitems.Count, requests);
                Thread.Sleep(1);
            }

            foreach (Account a in _eveaccounts)
            {
                foreach (Character c in a)
                {
                    foreach (XmlDocument doc in _contractitems)
                    {
                        string charid = doc.SelectSingleNode("/eveapi/characterid").InnerText;
                        if (c.CharacterID.Equals(charid))
                        {
                            c.ContractItemsXML = doc;
                        }
                    }
                }
            }
        }
        private void GetContractHeaders()
        {
            Display("Retrieving contract headers.");
            StringBuilder sb = new StringBuilder();
            CCPAPIInterfacer[] w = new CCPAPIInterfacer[_totalcharacters];

            int count = 0;
            try
            {
                foreach (Account a in _eveaccounts)
                {
                    foreach (Character c in a)
                    {
                        w[count] = new CCPAPIInterfacer(c);
                        sb.Append(_baseurl).Append(_contractsendpoint)
                            .Append("?keyid=").Append(a.KeyID)
                            .Append("&vcode=").Append(a.VCode)
                            .Append("&characterid=").Append(c.CharacterID);
                        w[count].AssociatedCharacter = c;
                        w[count].DownloadStringCompleted += w_ContractsEndpointResponse;
                        w[count].DownloadStringAsync(new Uri(sb.ToString()));
                        sb.Clear();
                        ++count;
                    }
                }
            }
            catch (Exception) { }

            while (_contractheaders.Count != _totalcharacters)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving contract headers {0} of {1}.", _contractheaders.Count, _totalcharacters);
                Thread.Sleep(1);
            }
        }
        private void GetMarketOrders()
        {
            Display("Retrieving market orders.");
            StringBuilder sb = new StringBuilder();
            CCPAPIInterfacer[] w = new CCPAPIInterfacer[_totalcharacters];
            // build URL list
            // make requests
            int count = 0;
            try
            {
                foreach (Account a in _eveaccounts)
                {
                    foreach (Character c in a)
                    {
                        w[count] = new CCPAPIInterfacer(c);
                        sb.Append(_baseurl).Append(_marketordersendpoint)
                        .Append("?keyid=").Append(a.KeyID)
                        .Append("&vcode=").Append(a.VCode)
                        .Append("&characterid=").Append(c.CharacterID);
                        w[count].AssociatedCharacter = c;
                        w[count].DownloadStringCompleted += w_MarketOrderEndpointResponse;
                        w[count].DownloadStringAsync(new Uri(sb.ToString()));
                        sb.Clear();
                        ++count;
                    }
                }
            }
            catch (Exception) { }

            while (_marketorderendpointresponses.Count != _totalcharacters)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving market orders {0} of {1}.", _marketorderendpointresponses.Count, _totalcharacters);
                Thread.Sleep(1);
            }

            foreach (Account a in _eveaccounts)
            {
                foreach (Character c in a)
                {
                    foreach (XmlDocument doc in _marketorderendpointresponses)
                    {
                        string charid = doc.SelectSingleNode("/eveapi/characterid").InnerText;
                        if (c.CharacterID.Equals(charid))
                        {
                            c.MarketOrdersXML = doc;
                        }
                    }
                }
            }
        }
        private void GetAccountBalances()
        {
            Display("Retrieving account balances.");
            StringBuilder sb = new StringBuilder();
            CCPAPIInterfacer[] w = new CCPAPIInterfacer[_totalcharacters];
            int count = 0;
            try
            {
                foreach (Account a in _eveaccounts)
                {
                    foreach (Character c in a)
                    {
                        w[count] = new CCPAPIInterfacer(c);
                        sb.Append(_baseurl).Append(_accountbalanceendpoint)
                        .Append("?keyid=").Append(a.KeyID)
                        .Append("&vcode=").Append(a.VCode)
                        .Append("&characterid=").Append(c.CharacterID);
                        w[count].AssociatedCharacter = c;
                        w[count].DownloadStringCompleted += w_AccountBalanceEndpointResponse;
                        w[count].DownloadStringAsync(new Uri(sb.ToString()));
                        sb.Clear();
                        ++count;
                    }
                }
            }
            catch (Exception) { }

            while (_accountbalanceresponses.Count != _totalcharacters)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving account balances {0} of {1}.", _accountbalanceresponses.Count, _totalcharacters);
                Thread.Sleep(1);
            }

            foreach (Account a in _eveaccounts)
            {
                foreach (Character c in a)
                {
                    foreach (XmlDocument doc in _accountbalanceresponses)
                    {
                        string charid = doc.SelectSingleNode("/eveapi/characterid").InnerText;
                        if (c.CharacterID.Equals(charid))
                        {
                            c.ISK = Convert.ToDecimal(doc.SelectSingleNode("/eveapi/result/rowset/row").Attributes["balance"].Value);
                        }
                    }
                }
            }

            _accountbalanceresponses.Clear();
        }
        /***********************************************************************
         * 
         * RETRIEVAL FUNCTIONS
         * 
         ***********************************************************************/

        private void GetAccountXML()
        {
            Display("Retrieving characters.");
            StringBuilder sb = new StringBuilder();
            CCPAPIInterfacer[] w = new CCPAPIInterfacer[3];

            try
            {
                for (int i = 0; i < _eveaccounts.Count; ++i)
                {
                    w[i] = new CCPAPIInterfacer(_eveaccounts[i]);
                    w[i].DownloadStringCompleted += w_AccountEndpointResponse;
                    sb.Append(_baseurl).Append(_accountendpoint).Append("?keyid=").Append(_eveaccounts[i].KeyID)
                    .Append("&vcode=").Append(_eveaccounts[i].VCode);
                    w[i].DownloadStringAsync(new Uri(sb.ToString()));
                    sb.Clear();
                }
            }
            catch (Exception) { }

            while (_accountendpointresponses.Count != _eveaccounts.Count)
            {
                //Console.Clear();
                //Console.WriteLine("Retrieving characters {0} of {1}.", _accountendpointresponses.Count, _eveaccounts.Count);
                Thread.Sleep(1);
            }

            foreach (Account a in _eveaccounts)
            {
                foreach (XmlDocument doc in _accountendpointresponses)
                {
                    string keyid = doc.SelectSingleNode("/eveapi/keyid").InnerText;
                    if (a.KeyID.Equals(keyid))
                    {
                        foreach (XmlNode node in doc.SelectNodes("/eveapi/result/rowset/row"))
                        {
                            string name = node.Attributes["name"].Value;
                            string charid = node.Attributes["characterID"].Value;
                            a.Add(new Character(name, charid));
                        }
                    }
                }
            }

            _accountendpointresponses.Clear();
        }