コード例 #1
0
        public void Stop()
        {
            TraceLogger.Instance.WriteLineInfo("Record Service stoping...");
            if (_tasks != null)
            {
                _tasks.Stop();
                _tasks = null;
            }
            TraceLogger.Instance.WriteLineInfo("Record Service stoped.");

            if (_adminWeb != null)
            {
                TraceLogger.Instance.WriteLineInfo("Admin Service is stoping...");
                _adminWeb.Stop();
                _adminWeb = null;
                TraceLogger.Instance.WriteLineInfo("Admin Service is stoped.");
            }
        }
コード例 #2
0
        public void Start()
        {
            TraceLogger.Instance.WriteLineInfo("Privileges ajusting...");
            bool succeed = WTSEngine.SetProcessPrivileges(Process.GetCurrentProcess().Id,
                                                          bfbd.WindowsAPI.WTS.NtPrivileges.SE_ASSIGNPRIMARYTOKEN_NAME,
                                                          bfbd.WindowsAPI.WTS.NtPrivileges.SE_INCREASE_QUOTA_NAME,
                                                          bfbd.WindowsAPI.WTS.NtPrivileges.SE_TCB_NAME);

            TraceLogger.Instance.WriteLineInfo("Privileges ajusted: " + succeed);

            TraceLogger.Instance.WriteLineInfo("Record Service is starting...");
            _tasks = new PeriodTask(1000);
            _tasks.AddTask("License", this.UpdateLicenseInfo, 60 * 60, 0);
            _tasks.AddTask("Configuration", this.UpdateConfigurationFile, 60, 0);
            _tasks.AddTask("Session", this.ScanWinSessionsToRecordOrEnd, 2, 10);
            _tasks.AddTask("Storage", StorageEngine.ScanAndStoreCacheFiles, 5, 15);
            _tasks.AddTask("Restrict", StorageEngine.ScanAndRestrictLocalStore, 60 * 60, 60 * 60);
            _tasks.AddTask("AccessPolicy", this.UpdateWebAccessPolicy, 60, 0);
            _tasks.Start();
            TraceLogger.Instance.WriteLineInfo("Record Service is started.");

            if (Global.Config.AdminWebPort > 80)
            {
                try
                {
                    TraceLogger.Instance.WriteLineInfo("Admin Service is starting...");
                    _adminWeb = new Server.AdminServiceCore();
                    _adminWeb.Start();
                    TraceLogger.Instance.WriteLineInfo("Admin Service is started.");
                }
                catch (Exception ex)
                {
                    TraceLogger.Instance.WriteException(ex);
                    _adminWeb = null;
                }
            }
        }