public bool Load() { this.SecurityObject = AdminServer.TheInstance.SecurityManager.Get(SecurityObjectBatchTaskManager); this._batchTaskList.Clear(); using (IBlazeDatabase db = DbFactory.GetDatabase()) { IBlazeTable table = db.GetTable(TableString.BatchTaskTableName); DataSet batchTaskDataSet = new DataSet(); table.Get(batchTaskDataSet); DataTable batchTaskTable = batchTaskDataSet.Tables[TableString.BatchTaskTableName]; StrategyManager sm = AdminServer.TheInstance.StrategyManager; AutomationManager am = AdminServer.TheInstance.AutomationManager; foreach (DataRow row in batchTaskTable.Rows) { int batchTaskId = (int)row[TableString.BatchTaskId]; try { BatchTask batchTask = new BatchTask(); batchTask.Step = (int)row[TableString.BatchTaskStep]; batchTask.Automation = am.Load((byte[])row[TableString.BatchTaskAutomation]); string serverIds = SystemConfig.Current.DefaultEncoding.GetString((byte[])row[TableString.BatchTaskServerIds]); foreach (string serverIdText in serverIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { int serverId = int.Parse(serverIdText); GameServer server = AdminServer.TheInstance.GameServerManager.GetGameServer(serverId); if (server != null) { batchTask.AddServer(serverId); } } FSEyeObject secObj = AdminServer.TheInstance.SecurityManager.Get(batchTaskId); if (secObj != null) { batchTask.SecurityObject = secObj; _batchTaskList.Add(batchTask); } } catch (Exception e) { Util.DebugLog(e.StackTrace); continue; } } return(true); } }
private AdminServer() { _disposed = false; _isRunning = false; _securityManager = new SecurityManager(); _gameServerManager = new GameServerManager(); _connectionManager = new ConnectionManager(); _messageEngine = new MessageEngine(); _gameServerMonitor = new GameServerMonitor(); _automationManager = new AutomationManager(); _strategyManager = new StrategyManager(); _scheduledTaskManager = new ScheduledTaskManager(); _FTPClient = new FTPClient(); _batchTaskManager = new BatchTaskManager(); _paysysManager = new PaysysManager(); _ibShopManager = new IBShopManager(); }
/// <summary> /// 载入策略配置 /// </summary> public void Load() { this.SecurityObject = AdminServer.TheInstance.SecurityManager.Get(SecurityObjectStrategyManager); _strategyList.Clear(); using (IBlazeDatabase db = DbFactory.GetDatabase()) { IBlazeTable table = db.GetTable(TableString.StrategyTableName); DataSet strategyData = new DataSet(); table.Get(strategyData); DataTable strategyTable = strategyData.Tables[TableString.StrategyTableName]; StrategyManager sm = AdminServer.TheInstance.StrategyManager; AutomationManager am = AdminServer.TheInstance.AutomationManager; foreach (DataRow row in strategyTable.Rows) { int strategyId = (int)row[TableString.StrategyFieldId]; try { Strategy strategy = new Strategy(); strategy.Event = (FSEyeEvent)row[TableString.StrategyFieldEvent]; strategy.Automation = am.Load((byte[])row[TableString.StrategyFieldAutomation]); strategy.Enabled = ((int)row[TableString.StrategyFieldEnabled]) == 0 ? false : true; FSEyeObject secObj = AdminServer.TheInstance.SecurityManager.Get(strategyId); if (secObj != null) { strategy.SecurityObject = secObj; _strategyList.Add(strategy); } } catch (Exception e) { Util.DebugLog(e.StackTrace); continue; } } } }