コード例 #1
0
        private void InitAutomations()
        {
            AutomationManager.Register(new NullAutomation());
            AutomationManager.Register(new WaitAutomation());
            AutomationManager.Register(new SelectServerAutomation());
            AutomationManager.Register(new CheckServerAutomation());
            AutomationManager.Register(new StartGameAutomation());
            AutomationManager.Register(new StopGameAutomation());
            AutomationManager.Register(new UpdateGameAutomation());
            AutomationManager.Register(new SendMailAutomation());
            AutomationManager.Register(new KillGameAutomation());
            AutomationManager.Register(new CreateServerListFilesAutomation());
            AutomationManager.Register(new LogAutomation());
            AutomationManager.Register(new GetStackTraceAutomation());
            AutomationManager.Register(new SendSystemMessageAutomation());
            AutomationManager.Register(new FilterServerAutomation());
            AutomationManager.Register(new CreateLordConfigAutomation());
            AutomationManager.Register(new FileTransferAutomation());
            AutomationManager.Register(new FileDownloadAutomation());
            AutomationManager.Register(new ExeSysCmdAutomation());
            AutomationManager.Register(new DeleteLocalFileAutomation());
            AutomationManager.Register(new BackupDatabaseAutomation());
            AutomationManager.Register(new RollbackDatabaseAutomation());
            AutomationManager.Register(new BatchTaskAutomation());
            AutomationManager.Register(new SendSMSAutomation());
            AutomationManager.Register(new UploadServerListFilesToFtpAutomation());

            AutomationManager.SecurityObject = SecurityManager.Get(SecurityObjectAutomationManager);
        }
コード例 #2
0
ファイル: Strategy.cs プロジェクト: uvbs/FullSource
        /// <summary>
        /// 更新策略
        /// </summary>
        public void Update(int strategyId, Strategy newStrategy, string name, string comment)
        {
            using (IBlazeDatabase db = DbFactory.GetDatabase())
            {
                try
                {
                    db.BeginTrans();

                    SecurityManager sm             = AdminServer.TheInstance.SecurityManager;
                    FSEyeObject     strategyObject = sm.Get(strategyId);
                    strategyObject.Name    = name;
                    strategyObject.Comment = comment;
                    sm.Set(strategyObject, db);
                    newStrategy.SecurityObject = strategyObject;

                    IBlazeTable table        = db.GetTable(TableString.StrategyTableName);
                    DataSet     strategyData = new DataSet();
                    table.Get(strategyData);
                    DataTable         strategyTable = strategyData.Tables[TableString.StrategyTableName];
                    AutomationManager am            = AdminServer.TheInstance.AutomationManager;

                    byte[]    strategyBytes = am.Save(newStrategy.Automation);
                    DataRow[] rows          = strategyTable.Select(TableString.StrategyFieldId + "=" + strategyId);
                    if (rows != null && rows.Length > 0)
                    {
                        DataRow row = rows[0];
                        row[TableString.StrategyFieldEvent]      = (int)newStrategy.Event;
                        row[TableString.StrategyFieldEnabled]    = (newStrategy.Enabled ? 1 : 0);
                        row[TableString.StrategyFieldAutomation] = strategyBytes;

                        table.Set(strategyTable);
                    }

                    for (int i = 0; i < _strategyList.Count; i++)
                    {
                        Strategy strategy = _strategyList[i] as Strategy;
                        if (strategy.SecurityObject.Id == strategyId)
                        {
                            _strategyList.RemoveAt(i);
                            _strategyList.Add(newStrategy);
                            break;
                        }
                    }

                    db.CommitTrans();
                }
                catch (Exception ex)
                {
                    if (db != null)
                    {
                        db.RollbackTrans();
                    }

                    throw ex;
                }
            }
        }
コード例 #3
0
ファイル: BatchTask.cs プロジェクト: weimingtom/pap2
        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);
            }
        }
コード例 #4
0
 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();
 }
コード例 #5
0
ファイル: Strategy.cs プロジェクト: uvbs/FullSource
        /// <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;
                    }
                }
            }
        }
コード例 #6
0
ファイル: AdminServer.cs プロジェクト: viticm/pap2
		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();
		}