Esempio n. 1
0
 internal ClientSet(IHostRoot root)
 {
     _root = root;
     GetSpeed();
     VirtualRoot.On <Per20SecondEvent>("周期性将内存中3分钟内活跃的ClientData列表刷入磁盘", LogEnum.DevConsole,
                                       action: message => {
         InitOnece();
         List <MinerData> minerDatas = new List <MinerData>();
         lock (_locker) {
             DateTime time = message.Timestamp.AddMinutes(-3);
             foreach (var clientData in _dicByObjectId.Values)
             {
                 if (clientData.ModifiedOn > time)
                 {
                     minerDatas.Add(new MinerData {
                         CreatedOn        = clientData.CreatedOn,
                         GroupId          = clientData.GroupId,
                         Id               = clientData.Id,
                         ClientId         = clientData.ClientId,
                         ClientName       = clientData.ClientName,
                         MinerIp          = clientData.MinerIp,
                         MinerName        = clientData.MinerName,
                         WindowsLoginName = clientData.WindowsLoginName,
                         WindowsPassword  = clientData.WindowsPassword,
                         WorkId           = clientData.WorkId
                     });
                 }
                 else
                 {
                     clientData.IsMining      = false;
                     clientData.MainCoinSpeed = 0;
                     clientData.DualCoinSpeed = 0;
                     foreach (var item in clientData.GpuTable)
                     {
                         item.MainCoinSpeed = 0;
                         item.DualCoinSpeed = 0;
                     }
                 }
             }
         }
         using (LiteDatabase db = HostRoot.CreateLocalDb()) {
             var col = db.GetCollection <MinerData>();
             col.Upsert(minerDatas);
         }
     });
 }
Esempio n. 2
0
 internal ClientSet(IHostRoot root)
 {
     _root = root;
     Global.Access <Per10SecondEvent>(
         Guid.Parse("ea795e07-7f4b-4284-aa72-aa00c17c89d8"),
         "周期性将内存中的ClientData列表刷入磁盘",
         LogEnum.Console,
         action: message => {
         InitOnece();
         lock (_locker) {
             DateTime time         = message.Timestamp.AddMinutes(-20);
             List <Guid> toRemoves = _dicById.Where(a => a.Value.ModifiedOn < time).Select(a => a.Key).ToList();
             foreach (var clientId in toRemoves)
             {
                 _dicById.Remove(clientId);
             }
             using (LiteDatabase db = HostRoot.CreateReportDb()) {
                 var col = db.GetCollection <ClientData>();
                 col.Upsert(_dicById.Values);
             }
         }
     });
 }
Esempio n. 3
0
 public PoolSet(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 4
0
 public MineWorkSet(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 5
0
 public MineProfileManager(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 6
0
 public WalletSet(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 7
0
 public OverClockDataSet(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 8
0
 public CalcConfigSet(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 9
0
 public ColumnsShowSet(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 10
0
 public MinerGroupSet(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 11
0
 public NTMinerFileSet(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 12
0
 public NTMinerWalletSet(IHostRoot root)
 {
     _root = root;
 }
Esempio n. 13
0
 public UserSet(IHostRoot root)
 {
     _root = root;
 }