ConfigFile.SetValue C# (CSharp) Method

SetValue() private method

private SetValue ( string section, string key, string define_value ) : void
section string
key string
define_value string
return void
    void SetValue(string section, string key, string define_value)
    {
        if (m_SectiontList.ContainsKey(section))
        {
            if (m_SectiontList[section].ContainsKey(key))
            {
                m_SectiontList[section][key] = define_value;
            }
            else
            {
                m_SectiontList[section].Add(key, define_value);
            }
        }
        else
        {
            m_SectiontList.Add(section, new Dictionary<string, string>());
            m_SectiontList[section].Add(key, define_value);
        }
    }

Usage Example

Example #1
0
 public bool SolveGitCredentialStore()
 {
     if (!CheckGitCredentialStore())
     {
         string gcsFileName = Path.Combine(Settings.GetInstallDir(), @"GitCredentialWinStore\git-credential-winstore.exe");
         if (File.Exists(gcsFileName))
         {
             ConfigFile config = GitCommandHelpers.GetGlobalConfig();
             if (EnvUtils.RunningOnWindows())
             {
                 config.SetValue("credential.helper", "!\\\"" + GitCommandHelpers.FixPath(gcsFileName) + "\\\"");
             }
             else if (EnvUtils.RunningOnMacOSX())
             {
                 config.SetValue("credential.helper", "osxkeychain");
             }
             else
             {
                 config.SetValue("credential.helper", "cache --timeout=300"); // 5 min
             }
             config.Save();
             return(true);
         }
         return(false);
     }
     return(true);
 }
All Usage Examples Of ConfigFile::SetValue