コード例 #1
0
        /// <inheritdoc />
        public override void Init(ITorchBase torch)
        {
            base.Init(torch);
            var configFile = Path.Combine(StoragePath, "RestartWatchdog.cfg");

            try {
                _config = Persistent <RestartConfig> .Load(configFile);
            } catch (Exception e) {
                Log.Warn(e);
            }

            if (_config?.Data == null)
            {
                Log.Info("Create Default Config, because none was found!");

                _config = new Persistent <RestartConfig>(configFile, new RestartConfig());
                _config.Save();
            }

            var pgmr = new RestartManager(torch);

            torch.Managers.AddManager(pgmr);

            Instance = this;
        }
コード例 #2
0
 public Control(RestartPlugin plugin) : this()
 {
     Plugin      = plugin;
     DataContext = plugin.Config;
 }