using LibGit2Sharp.Core; namespace LibGit2Sharp { /// /// Provides helper overloads to a . /// public static class ConfigurationExtensions { /// /// Get a configuration value for the given key parts. /// /// For example in order to get the value for this in a .git\config file: /// /// /// [core] /// bare = true /// /// /// You would call: /// /// /// bool isBare = repo.Config.Get<bool>(new []{ "core", "bare" }).Value; /// /// /// /// The configuration value type /// The configuration being worked with. /// The key parts /// The , or null if not set public static ConfigurationEntry Get(this Configuration config, string[] keyParts) { Ensure.ArgumentNotNull(keyParts, "keyParts"); return config.Get(string.Join(".", keyParts)); } /// /// Get a configuration value for the given key parts. /// /// For example in order to get the value for this in a .git\config file: /// /// /// [difftool "kdiff3"] /// path = c:/Program Files/KDiff3/kdiff3.exe /// /// /// You would call: /// /// /// string where = repo.Config.Get<string>("difftool", "kdiff3", "path").Value; /// /// /// /// The configuration value type /// The configuration being worked with. /// The first key part /// The second key part /// The third key part /// The , or null if not set public static ConfigurationEntry Get(this Configuration config, string firstKeyPart, string secondKeyPart, string thirdKeyPart) { Ensure.ArgumentNotNullOrEmptyString(firstKeyPart, "firstKeyPart"); Ensure.ArgumentNotNullOrEmptyString(secondKeyPart, "secondKeyPart"); Ensure.ArgumentNotNullOrEmptyString(thirdKeyPart, "secondKeyPart"); return config.Get(new[] { firstKeyPart, secondKeyPart, thirdKeyPart }); } } }