Пример #1
0
        public void Load(bool createIfNotExists = true)
        {
            Loading = true;
            AdmConfig deser = Deserialize <AdmConfig>(ConfigFilePath, Config, createIfNotExists);

            Config  = deser ?? Config;
            Loading = false;
        }
        public void Load()
        {
            Loading = true;
            AdmConfig deser = Deserialize <AdmConfig>(ConfigFilePath, Config);
            AdmConfig old   = Config;

            Config  = deser ?? Config;
            Loading = false;
        }
 protected AdmConfigBuilder()
 {
     if (instance == null)
     {
         Config           = new AdmConfig();
         LocationData     = new AdmLocationData();
         UpdaterData      = new UpdaterData();
         ConfigDir        = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "AutoDarkMode");
         ConfigFilePath   = Path.Combine(ConfigDir, "config.yaml");
         LocationDataPath = Path.Combine(ConfigDir, "location_data.yaml");
         UpdaterDataPath  = Path.Combine(ConfigDir, "update.yaml");
     }
 }
 /// <summary>
 /// Event source tha should trigger whenever the main configuration file has updated
 /// </summary>
 /// <param name="old"></param>
 public void OnConfigUpdated(AdmConfig old)
 {
     configUpdatedHandler?.Invoke(old, Config);
 }