Example #1
0
    public void Change (string keyName, string keyValue)
    {
      if (Result.IsValid) {
        IniFileManager.ChangeKey (SupportSection, keyName, keyValue);
        IniFileManager.SaveChanges ();

        TSupportSettingsData.Select (keyName, keyValue);
      }
    }
Example #2
0
    public bool Validate ()
    {
      bool res = false;

      Result.CopyFrom (IniFileManager.ValidatePath ());

      // file found
      if (Result.IsValid) {
        // create new section
        if (IniFileManager.ContainsSection (SupportSection).IsFalse ()) {
          var token = IniFileManager.AddSection (SupportSection);

          foreach (var settingsName in m_SupportSettingsData.SettingsNames) {
            var keyName = settingsName;
            var keyValue = TSupportSettingsData.Request (settingsName);

            TIniFileManager.AddKey (token, keyName, keyValue);
          }

          IniFileManager.SaveChanges ();
        }

        // update support settings data
        else {
          foreach (var settingsName in m_SupportSettingsData.SettingsNames) {
            if (IniFileManager.ContainsKey (SupportSection, settingsName)) {
              var settingsValue = IniFileManager.RequestKey (SupportSection, settingsName);
              TSupportSettingsData.Select (settingsName, settingsValue);
            }
          }
        }

        res = true;
      }

      return (res);
    }