Esempio n. 1
0
 public void Dispose()
 {
     MuCore.ConnectionToSettings?.DisposeAsyncServer();
     TaskerReporter.DisposeTasker();
     RestartTaskerReporter.DisposeTasker();
     NetworkForActions.StopServer();
     PerformanceReporter.Stop();
 }
Esempio n. 2
0
 public static new void Start()
 {
     if (self == null)
     {
         self = new RestartTaskerReporter();
     }
     if (self.isStarted)
     {
         return;
     }
     self.isStarted = true;
     self.StartTaskThreadTimer();
 }
Esempio n. 3
0
        private bool Initialize()
        {
            if (!File.Exists(MainSettings.JsonSettingsFileFullPath))
            {
                NLogger.LogErrorToHdd("Json - файл настроек не найден", MainSettings.Constants.MAGIC_UPDATER);
                return(false);
            }

            //Загружаем все настройки
            TryLoadMainSettings loadSettingsResult = MainSettings.LoadSettings();

            while (!loadSettingsResult.IsComplete)
            {
                NLogger.LogErrorToHdd(loadSettingsResult.NamedMessage, MainSettings.Constants.MAGIC_UPDATER);
                Thread.Sleep(60000);
                loadSettingsResult = MainSettings.LoadSettings();
            }

            if (MainSettings.MainSqlSettings.ComputerId == null || MainSettings.MainSqlSettings.ComputerId == 0)
            {
                NLogger.LogErrorToHdd("Ошибка регистрации компьютера. Не получен ComputerId.", MainSettings.Constants.MAGIC_UPDATER);
                return(false);
            }

            //Отчитываемся о том, что настройки прочитаны
            SqlWorks.ExecProc("SetIsAgentSettingsReaded", MainSettings.MainSqlSettings.ComputerId, true);

            //Если не режим отладки плагинов
            if (!_isPluginDebugMode)
            {
                SqlWorks.ExecProc("UpdateVersion", MainSettings.MainSqlSettings.ComputerId, Extensions.GetApplicationVersion());
                TaskerReporter.Start();
                RestartTaskerReporter.Start();
                switch (MainSettings.LocalSqlSettings.PerformanceCounterMode)
                {
                case 0:
                    break;

                case 1:
                    PerformanceReporter.StartOnlyAvg();
                    break;

                case 2:
                    PerformanceReporter.StartAll();
                    break;
                }
            }

            return(true);
        }