//Betölti a konfigurációt a bin fájlból vagy ha nem találja vagy nem beolvasható, akkor beállítja a default értékeket
        private void loadConfigFile()
        {
            SelectedMinerSettings = ConfigurationHandler.GetConfig();
            CustomSettings        = ConfigurationHandler.GetCustomConfig();
            var PoolList = PoolHandler.GetPools();

            foreach (var pool in PoolHandler.GetPools())
            {
                Pools.Add(new PoolSettingsXmlUI()
                {
                    Algorithm        = pool.Algorithm,
                    CoinType         = pool.CoinType,
                    FailOverPriority = pool.FailOverPriority,
                    ID             = pool.ID,
                    IsCPUPool      = pool.IsCPUPool,
                    IsGPUPool      = pool.IsGPUPool,
                    IsFailOver     = pool.IsFailOver,
                    IsMain         = pool.IsMain,
                    IsRemoveable   = pool.IsRemoveable,
                    Name           = pool.Name,
                    Password       = pool.Password,
                    Port           = pool.Port,
                    StatsAvailable = pool.StatsAvailable,
                    StatUrl        = pool.StatUrl,
                    URL            = pool.URL,
                    Username       = pool.Username,
                    Website        = pool.Website
                });
            }

            SelectedPool      = Pools[0];
            SelectedPoolIndex = 0;
        }
示例#2
0
        public SettingsViewModel()
        {
            Pools.Add("Ethermine");
            Pools.Add("Ethpool");
            Pools.Add("Flypool");

            ReadSettings();
        }
示例#3
0
        private TileBrushManager(LibraryX.TileBrushGroupX proxy, TilePoolManager tileManager, DynamicTileBrushClassRegistry registry)
        {
            _staticBrushCollection  = StaticTileBrushCollection.FromXProxy(proxy.StaticBrushes, tileManager);
            _dynamicBrushCollection = DynamicTileBrushCollection.FromXProxy(proxy.DynamicBrushes, tileManager, registry);

            Pools.Add(_staticBrushCollection);
            Pools.Add(_dynamicBrushCollection);
        }
示例#4
0
        public TileBrushManager()
        {
            _staticBrushCollection  = new TileBrushCollection <StaticTileBrush>("Static Brushes");
            _dynamicBrushCollection = new TileBrushCollection <DynamicTileBrush>("Dynamic Brushes");

            Pools.Add(_staticBrushCollection);
            Pools.Add(_dynamicBrushCollection);
        }
示例#5
0
        private static List <User> AddCharacters(string phase, string spreadsheetid, string Platoon, List <User> usersList, string PlatoonName)
        {
            IList <IList <Object> > Data = GoogleSheetReader(spreadsheetid, Platoon);

            foreach (User user in usersList)
            {
                List <Pool> Pools;
                if (user.Pools == null)
                {
                    Pools = new List <Pool>();
                }
                else
                {
                    Pools = user.Pools;
                }

                List <Order> Characters         = new List <Order>();
                Pool         Pool               = new Pool();
                bool         PoolAddedCharacter = false;
                bool         UserAddedCharacter = false;
                foreach (var Row in Data)
                {
                    int i = 0;
                    foreach (var item in Row)
                    {
                        if (user.name == (string)item)
                        {
                            Order Character = new Order();
                            Pool.Phase           = phase;
                            Pool.Platoon         = PlatoonName;
                            Character.Character  = (string)Row[i - 1];
                            Character.PlatoonNum = FindPlatoonNumber(i);
                            Characters.Add(Character);
                            Pool.Orders = Characters;

                            PoolAddedCharacter = true;
                            UserAddedCharacter = true;
                        }
                        i++;
                    }
                }
                if (PoolAddedCharacter == true)
                {
                    Pools.Add(Pool);
                    PoolAddedCharacter = false;
                }
                if (UserAddedCharacter == true)
                {
                    user.Pools         = Pools;
                    UserAddedCharacter = false;
                }
            }


            return(usersList);
        }
示例#6
0
        public TilePool CreatePool(string name, int tileWidth, int tileHeight)
        {
            //if (Pools.Contains(name))
            //    throw new ArgumentException("Manager already contains a pool with the given name.", "name");

            TilePool pool = new TilePool(this, name, tileWidth, tileHeight);

            Pools.Add(pool);

            return(pool);
        }
示例#7
0
 private static void LoadPools()
 {
     using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AssetViewer.Resources.Assets.RewardPools.xml"))
         using (var reader = new StreamReader(stream)) {
             var document = XDocument.Parse(reader.ReadToEnd()).Root;
             foreach (var item in document.Elements().Select(s => s.FromXElement <Pool>()))
             {
                 Pools.Add(item.ID, item);
             }
         }
 }
示例#8
0
        public TilePool ImportPool(string name, TextureResource source, TilePool.TileImportOptions options)
        {
            //if (Pools.Contains(name))
            //    throw new ArgumentException("Manager already contains a pool with the given name.", "name");

            TilePool pool = new TilePool(this, name, options.TileWidth, options.TileHeight);

            pool.ImportMerge(source, options);
            Pools.Add(pool);

            return(pool);
        }
        private void AddPool(PoolSettingsXmlUI ps)
        {
            if (ps.IsMain)
            {
                var mainPool = Pools.Where(x => x.IsMain).FirstOrDefault();
                if (mainPool != null)
                {
                    mainPool.IsMain = false;
                }
            }

            Pools.Add(ps);
            SavePools(null);
        }
示例#10
0
 private void CreateNewPool()
 {
     if (Pools.Count < MaxPoolCount)
     {
         MTQueuePool <T> pool = new MTQueuePool <T>();
         pool.Manager      = this;
         pool.PoolCapacity = MaxPoolCapacity;
         pool.SleepTime    = PoolSleepTime;
         pool.Action       = Action;
         pool.Initialize();
         Pools.Add(pool);
         pool.Start();
     }
 }
示例#11
0
        public bool RegisterPool(DhcpPool pool)
        {
            var conflictingPool = GetPoolByPrefix(pool.Network);

            if (conflictingPool != null)
            {
                return(false);
            }

            Pools.Add(pool);
            AddressPools.Add(new DhcpAddressPool(pool));

            return(true);
        }
示例#12
0
        public BufferPool(string name, int initialCapacity, int bufferSize)
        {
            m_Name = name;

            m_InitialCapacity = initialCapacity;
            m_BufferSize      = bufferSize;

            m_FreeBuffers = new Queue <byte[]>(initialCapacity);

            for (int i = 0; i < initialCapacity; ++i)
            {
                m_FreeBuffers.Enqueue(new byte[bufferSize]);
            }

            lock (Pools)
                Pools.Add(this);
        }
示例#13
0
        /// <summary>
        /// 系统启动时调用
        /// </summary>
        void IZeroObject.OnStationStateChanged(StationConfig config)
        {
            StationSocketPool pool;

            lock (Pools)
            {
                if (!Pools.TryGetValue(config.StationName, out pool))
                {
                    return;
                }
            }
            switch (config.State)
            {
            case ZeroCenterState.Run when pool != null:
                pool.Resume();
                break;

            case ZeroCenterState.Run:
                lock (Pools)
                {
                    if (!Pools.ContainsKey(config.StationName))
                    {
                        Pools.Add(config.StationName, new StationSocketPool
                        {
                            Config = config
                        });
                    }
                }

                break;

            default:
                pool?.Dispose();
                break;
            }
        }
示例#14
0
        /// <summary>
        /// 系统启动时调用
        /// </summary>
        public bool OnZeroStart()
        {
            foreach (var pool in Pools.Values)
            {
                pool.Resume();
            }

            lock (Pools)
            {
                ZeroApplication.Config.Foreach(config =>
                {
                    if (!Pools.ContainsKey(config.StationName))
                    {
                        Pools.Add(config.StationName, new StationSocketPool
                        {
                            Config = config
                        });
                    }
                });
            }
            CanDo = true;
            ZeroApplication.OnObjectActive(this);
            return(true);
        }
示例#15
0
        private void PoolBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            bool?modified = false;

            using (var context = new Context())
            {
                foreach (var pool in context.Pools)
                {
                    if (!Pools.Any(c => c.Id == pool.Id))
                    {
                        Pools.Add(pool);
                        modified = true;
                    }

                    var currentPool = Pools.FirstOrDefault(c => c.Id == pool.Id);

                    var nanopool = new Nanopool(pool.Type, GetWebProxy());
                    var result   = nanopool.GetListOfWorkers(pool.Wallet);

                    if (result != null && result.Status)
                    {
                        var newWorkers = new List <Worker>();
                        var removed    = 0;

                        if (pool.Workers.Any())
                        {
                            removed = pool.Workers.RemoveAll(x => !result.Data.Exists(y => y.Uid == x.Uid));
                        }

                        foreach (var worker in result.Data)
                        {
                            Worker current = null;

                            if (currentPool.Workers.Any())
                            {
                                current = currentPool.Workers.FirstOrDefault(c => c.Uid == worker.Uid);
                            }

                            if (current == null)
                            {
                                newWorkers.Add(worker);
                            }
                            else
                            {
                                worker.UpdateOther(current);
                            }
                        }

                        if (removed > 0)
                        {
                            modified = true;
                        }

                        if (newWorkers.Any())
                        {
                            currentPool.Workers.AddRange(newWorkers);
                            modified = true;
                        }
                    }
                }
            }

            e.Result = modified;
        }