Esempio n. 1
0
        /*
         *  Market.UpdateMarketGroups();
         *  Market.UpdateMarketValues();
         *  //Market.UpdateRegionMarket(999);
         *  Market.UpdateRegionMarket(10000030);
         *  List<long> orderIDs = Market.GetOrdersForTypeAndRegion(34, 10000030);
         *  Market.MarketOrder order = Market.GetOrder(orderIDs[0]);
         *  Sovereignty.UpdateStructures();
         *  Sovereignty.Structure str = Sovereignty.GetStructure(1035629924);
         *  Sovereignty.UpdateMap();
         *  Sovereignty.Map map = Sovereignty.GetMap(30000721);
         */
        public static void pathTest()
        {
            // Will only work after loading successful.
            DateTime    s     = DateTime.Now;
            SolarSystem start = SolarSystem.GetSystem(30002510);
            List <int>  path  = start.FindPath(30000142, true);

            if (path == null)
            {
                System.Diagnostics.Debug.WriteLine("Path not found.");
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(path.Count + " jumps.");
                foreach (int systemID in path)
                {
                    //SolarSystem system = SolarSystem.getSystem(systemID);
                    System.Diagnostics.Debug.WriteLine(systemID + ": " + InvNames.GetName(systemID));
                }
            }
            DateTime f  = DateTime.Now;
            TimeSpan ts = f - s;

            System.Diagnostics.Debug.WriteLine("Path test took: " + ts.TotalMilliseconds + " ms");
        }
Esempio n. 2
0
        private void PopulateOrders(int typeID, int regionID)
        {
            List <Market.MarketOrder> orders;

            if (regionID > 0)
            {
                orders = Market.GetOrdersForTypeAndRegion(typeID, regionID);
            }
            else if (regionID == 0)
            {
                // No region selected, leave empty.
                return;
            }
            else
            {
                // All regions selected
                orders = Market.GetOrdersForType(typeID);
            }
            string[] selCols = new string[4];
            string[] buyCols = new string[6];
            foreach (Market.MarketOrder order in orders)
            {
                TimeSpan expiresIn   = new TimeSpan(order.duration, 0, 0, 0) - (DateTime.Now - order.issued);
                string   expireStr   = expiresIn.Days.ToString() + "D " + expiresIn.Hours.ToString() + "H " + expiresIn.Minutes.ToString() + "M " + expiresIn.Seconds.ToString() + "S";
                string   locationStr = InvNames.GetName((int)order.location_id);
                if (locationStr == null)
                {
                    // Get structure name.
                    // TO-DO:
                    locationStr = "Structure: " + order.location_id.ToString();
                }
                if (order.is_buy_order)
                {
                    buyCols[0] = order.volume_remain.ToString();
                    buyCols[1] = order.price.ToString("N2");
                    buyCols[2] = locationStr;
                    buyCols[3] = order.range;
                    buyCols[4] = order.min_volume.ToString();
                    buyCols[5] = expireStr;
                    ListViewItem item = new ListViewItem(buyCols);
                    marketBuyersList.Items.Add(item);
                }
                else
                {
                    selCols[0] = order.volume_remain.ToString();
                    selCols[1] = order.price.ToString("N2");
                    selCols[2] = locationStr;
                    selCols[3] = expireStr;
                    ListViewItem item = new ListViewItem(selCols);
                    marketSellersList.Items.Add(item);
                }
            }
        }