Beispiel #1
0
        /// <summary>
        /// Get list of all orders.
        /// </summary>
        /// <param name="ServiceLocation">Service location; 0 for NiceHash, 1 for WestHash.</param>
        /// <param name="Algorithm">Algorithm number.</param>
        /// <param name="ForceReCache">Set this to true to recache order list.</param>
        /// <returns>Array list of orders.</returns>
        public static List <Order> GetAllOrders(int ServiceLocation, int Algorithm, bool ForceReCache)
        {
            lock (CacheLock)
            {
                if (ForceReCache || CachedOList[ServiceLocation, Algorithm] == null || (CachedOList[ServiceLocation, Algorithm].ObtainTime + TimeSpan.FromSeconds(29.0) < DateTime.Now))
                {
                    CachedOList[ServiceLocation, Algorithm]           = new CachedOrderList();
                    CachedOList[ServiceLocation, Algorithm].OrderList = GetOrders(ServiceLocation, Algorithm, "orders.get", false);

                    // Get missing data for my orders
                    List <Order> MyOrders = GetMyOrders(ServiceLocation, Algorithm);

                    // Fill missing data
                    if (MyOrders != null && CachedOList[ServiceLocation, Algorithm].OrderList != null)
                    {
                        foreach (Order O1 in MyOrders)
                        {
                            foreach (Order O2 in CachedOList[ServiceLocation, Algorithm].OrderList)
                            {
                                if (O2.ID == O1.ID)
                                {
                                    O2.BTCAvailable = O1.BTCAvailable;
                                }
                            }
                        }
                    }

                    CachedOList[ServiceLocation, Algorithm].ObtainTime = DateTime.Now;
                }

                return(CachedOList[ServiceLocation, Algorithm].OrderList);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Get list of all orders.
        /// </summary>
        /// <param name="ServiceLocation">Service location; 0 for NiceHash, 1 for WestHash.</param>
        /// <param name="Algorithm">Algorithm number.</param>
        /// <param name="ForceReCache">Set this to true to recache order list.</param>
        /// <returns>Array list of orders.</returns>
        public static List <Order> GetAllOrders(int ServiceLocation, int Algorithm, bool ForceReCache)
        {
            lock (CacheLock)
            {
                if (ForceReCache || CachedOList[ServiceLocation, Algorithm] == null || (CachedOList[ServiceLocation, Algorithm].ObtainTime + TimeSpan.FromSeconds(29.0) < DateTime.Now))
                {
                    CachedOList[ServiceLocation, Algorithm]            = new CachedOrderList();
                    CachedOList[ServiceLocation, Algorithm].OrderList  = GetOrders(ServiceLocation, Algorithm, "orders.get", false);
                    CachedOList[ServiceLocation, Algorithm].ObtainTime = DateTime.Now;
                }

                return(CachedOList[ServiceLocation, Algorithm].OrderList);
            }
        }