Example #1
0
        public bool LoadFromEveCentral()
        {
            try
            {
                string url = "http://api.eve-central.com/api/marketstat?typeid=" + TypeId.ToString() + "&usesystem=30000142";

                HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(url);
                HttpWebResponse response = null;

                try
                {
                    response = (HttpWebResponse)request.GetResponse();
                }
                catch (Exception ex)
                {
                    if (Logging.ShowDebugMessages == true)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    return(false);
                }

                Stream       resStream = response.GetResponseStream();
                StreamReader reader    = new StreamReader(resStream, Encoding.UTF8);
                string       resString = reader.ReadToEnd();

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(resString);

                Sell            = new MarketStat();
                Sell.Volume     = long.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/volume").InnerText);
                Sell.Avg        = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/avg").InnerText);
                Sell.Max        = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/max").InnerText);
                Sell.Min        = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/min").InnerText);
                Sell.Stddev     = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/stddev").InnerText);
                Sell.Median     = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/median").InnerText);
                Sell.Percentile = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/percentile").InnerText);

                Buy            = new MarketStat();
                Buy.Volume     = long.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/volume").InnerText);
                Buy.Avg        = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/avg").InnerText);
                Buy.Max        = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/max").InnerText);
                Buy.Min        = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/min").InnerText);
                Buy.Stddev     = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/stddev").InnerText);
                Buy.Median     = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/median").InnerText);
                Buy.Percentile = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/percentile").InnerText);

                All            = new MarketStat();
                All.Volume     = long.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/volume").InnerText);
                All.Avg        = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/avg").InnerText);
                All.Max        = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/max").InnerText);
                All.Min        = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/min").InnerText);
                All.Stddev     = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/stddev").InnerText);
                All.Median     = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/median").InnerText);
                All.Percentile = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/percentile").InnerText);

                return(true);
            }
            catch (Exception ex)
            {
                if (Logging.ShowDebugMessages == true)
                {
                    MessageBox.Show(ex.Message);
                }
                return(false);
            }
        }
Example #2
0
        public bool LoadFromEveCentral()
        {
            try
            {
                string url = "http://api.eve-central.com/api/marketstat?typeid=" + TypeId.ToString() + "&usesystem=30000142";

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                HttpWebResponse response = null;

                try
                {
                    response = (HttpWebResponse)request.GetResponse();
                }
                catch (Exception ex)
                {
                    if (Logging.ShowDebugMessages == true)
                        MessageBox.Show(ex.Message);
                    return false;
                }

                Stream resStream = response.GetResponseStream();
                StreamReader reader = new StreamReader(resStream, Encoding.UTF8);
                string resString = reader.ReadToEnd();

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(resString);

                Sell = new MarketStat();
                Sell.Volume = long.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/volume").InnerText);
                Sell.Avg = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/avg").InnerText);
                Sell.Max = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/max").InnerText);
                Sell.Min = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/min").InnerText);
                Sell.Stddev = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/stddev").InnerText);
                Sell.Median = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/median").InnerText);
                Sell.Percentile = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/sell/percentile").InnerText);

                Buy = new MarketStat();
                Buy.Volume = long.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/volume").InnerText);
                Buy.Avg = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/avg").InnerText);
                Buy.Max = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/max").InnerText);
                Buy.Min = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/min").InnerText);
                Buy.Stddev = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/stddev").InnerText);
                Buy.Median = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/median").InnerText);
                Buy.Percentile = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/buy/percentile").InnerText);

                All = new MarketStat();
                All.Volume = long.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/volume").InnerText);
                All.Avg = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/avg").InnerText);
                All.Max = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/max").InnerText);
                All.Min = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/min").InnerText);
                All.Stddev = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/stddev").InnerText);
                All.Median = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/median").InnerText);
                All.Percentile = double.Parse(doc.DocumentElement.SelectSingleNode("/evec_api/marketstat/type/all/percentile").InnerText);

                return true;
            }
            catch (Exception ex)
            {
                if (Logging.ShowDebugMessages == true)
                    MessageBox.Show(ex.Message);
                return false;
            }
        }