コード例 #1
0
        private void LoadControllerSettings()
        {
            Settings = new SettingsContainer(StoragePath.WithFilename("Settings.json"));

            Settings.SetValue("Name", "HA4IoT Controller");
            Settings.SetValue("Description", "The HA4IoT controller which is responsible for this house.");

            Settings.Load();
        }
コード例 #2
0
        public AreaSettingsWrapper(ISettingsContainer settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Settings = settings;
            Settings.SetValue("appSettings", new JsonObject());
        }
コード例 #3
0
        public ComponentSettingsWrapper(ISettingsContainer settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Settings = settings;

            IsEnabled = true;
            Settings.SetValue("appSettings", new JsonObject());
        }
コード例 #4
0
 private static void TextToSettings(string text, ISettingsContainer settings)
 {
     using (StringReader reader = new StringReader(text))
     {
         string line;
         while ((line = reader.ReadLine()) != null)
         {
             var pair = line.Split(new char[] { '=' }, 2);
             if (pair.Length == 2)
             {
                 settings.SetValue(pair[0], pair[1]);
             }
         }
     }
 }