예제 #1
0
        static int Main()
        {
            System.Environment.CurrentDirectory = Application.StartupPath;

            InitLog();

            if (CheckOverlappedExecute() == true)
            {
                ActivateAlreadyOpenedServerMonitor();
                return(0);
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ServerMonitor     serverMonitor     = new ServerMonitor();
            FormServerMonitor formServerMonitor = new FormServerMonitor(serverMonitor);

            if (serverMonitor.Init(formServerMonitor) == false)
            {
                FileLog.Instance.Write("실패! ServerMonitor 초기화에 실패했습니다!");
                serverMonitor.Destroy();
                return(-1);
            }
            Application.Run(formServerMonitor);

            return(0);
        }
예제 #2
0
        public bool Init(FormServerMonitor refServerMonitorView)
        {
            m_refView = refServerMonitorView;

            m_config = new Config(new ConfigFileController());
            if (m_config.ReadConfigINI() == false)
            {
                FileLog.Instance.Write("실패! INI파일의 설정을 읽지 못했습니다!");
                return(false);
            }

            if (m_config.LoadConfig() == false)
            {
                FileLog.Instance.Write("실패! Config 파일 읽기에 실패했습니다!");
                return(false);
            }
            FileLog.Instance.Write("Config 파일 로드.");

            m_netServer = new NetServer(this);
            if (m_netServer.Start(m_config.PortNumber) == false)
            {
                FileLog.Instance.Write("실패! Network 초기화에 실패했습니다!");
                return(false);
            }
            FileLog.Instance.Write("Network 초기화.");

            if (m_dbMgr.Create(m_config.DB_DataSource, m_config.DB_InitialCatalog, m_config.DB_UserID, m_config.DB_Password) == false)
            {
                FileLog.Instance.Write("실패! DBMgr 생성에 실패했습니다!");
                return(false);
            }
            FileLog.Instance.Write("DBMgr 생성.");

            if (m_serverInfoMgr.Init(m_config.refListServerInfo, m_config.AddServerInfo, m_config.DeleteServerInfo) == false)
            {
                FileLog.Instance.Write("실패! ServerInfoMgr 초기화에 실패했습니다!");
                return(false);
            }
            FileLog.Instance.Write("ServerInfoMgr 초기화.");

            if (InitMonitoringLog(m_dbMgr, m_logStringMgr) == false)
            {
                FileLog.Instance.Write("실패! Monitoring Log 초기화에 실패했습니다!");
                return(false);
            }
            FileLog.Instance.Write("MonitoringLoggerMgr 초기화.");


            m_updaterServerDBInfo = new ServerDBInfoUpdater(m_serverInfoMgr, m_dbMgr);

            ProcessSystem processSystem = new ProcessSystem();

            m_serverController      = new ServerController(m_serverInfoMgr, processSystem, m_monitoringLoggerMgr);
            m_serverReviver         = new ServerReviver(m_serverInfoMgr, m_serverController);
            m_checkerServerState    = new ProcessStateChecker(m_serverInfoMgr, processSystem, m_monitoringLoggerMgr);
            m_updaterServableState  = new ServableStateUpdater(m_serverInfoMgr, m_monitoringLoggerMgr);
            m_updaterServerListView = new ServerListViewUpdater(m_refView.refLViewServerList, m_refView.refColServerName.Index, m_serverInfoMgr);
            m_updaterServerListView.BuildServerListView();

            FileLog.Instance.Write("ServerMonitor 초기화.");

            m_refView.UpdateStatusBar(m_serverMonitorClientMgr.SessionCount);

            return(true);
        }