diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-11-07 21:11:14 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-12-05 11:38:18 +0400 |
commit | 3d29d95dc7d0addc889679c93d22952fe7bb9d35 (patch) | |
tree | cb9f1a8f4a29d829e3644584ffa3ec3ad5d5956e /LibGit2Sharp/Configuration.cs | |
parent | b5707fbdda084676215b31a0c589d1a942d80dfe (diff) |
Turn Configuration overloads into extension methods
Signed-off-by: Unit Test <yoram.harmelin@gmail.com>
Diffstat (limited to 'LibGit2Sharp/Configuration.cs')
-rw-r--r-- | LibGit2Sharp/Configuration.cs | 195 |
1 files changed, 0 insertions, 195 deletions
diff --git a/LibGit2Sharp/Configuration.cs b/LibGit2Sharp/Configuration.cs index f676262e..c9399939 100644 --- a/LibGit2Sharp/Configuration.cs +++ b/LibGit2Sharp/Configuration.cs @@ -149,19 +149,6 @@ namespace LibGit2Sharp } /// <summary> - /// Delete a configuration variable (key and value). - /// </summary> - /// <param name = "key">The key to delete.</param> - /// <param name = "level">The configuration file which should be considered as the target of this operation</param> - [Obsolete("This method will be removed in the next release. Please use Unset() instead.")] - public void Delete(string key, ConfigurationLevel level = ConfigurationLevel.Local) - { - Ensure.ArgumentNotNullOrEmptyString(key, "key"); - - Unset(key, level); - } - - /// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> protected virtual void Dispose(bool disposing) @@ -184,130 +171,6 @@ namespace LibGit2Sharp /// You would call: /// /// <code> - /// bool isBare = repo.Config.Get<bool>("core.bare", false); - /// </code> - /// </para> - /// </summary> - /// <typeparam name = "T">The configuration value type</typeparam> - /// <param name = "key">The key</param> - /// <param name = "defaultValue">The default value</param> - /// <returns>The configuration value, or <c>defaultValue</c> if not set</returns> - [Obsolete("This method will be removed in the next release. Please use a different overload instead.")] - public virtual T Get<T>(string key, T defaultValue) - { - Ensure.ArgumentNotNullOrEmptyString(key, "key"); - - var val = Get<T>(key); - - return val == null ? defaultValue : val.Value; - } - - /// <summary> - /// Get a configuration value for a key. Keys are in the form 'section.name'. - /// <para> - /// For example in order to get the value for this in a .git\config file: - /// - /// <code> - /// [core] - /// bare = true - /// </code> - /// - /// You would call: - /// - /// <code> - /// bool isBare = repo.Config.Get<bool>("core", "bare", false); - /// </code> - /// </para> - /// </summary> - /// <typeparam name = "T">The configuration value type</typeparam> - /// <param name = "firstKeyPart">The first key part</param> - /// <param name = "secondKeyPart">The second key part</param> - /// <param name = "defaultValue">The default value</param> - /// <returns>The configuration value, or <c>defaultValue</c> if not set</returns> - [Obsolete("This method will be removed in the next release. Please use a different overload instead.")] - public virtual T Get<T>(string firstKeyPart, string secondKeyPart, T defaultValue) - { - Ensure.ArgumentNotNullOrEmptyString(firstKeyPart, "firstKeyPart"); - Ensure.ArgumentNotNullOrEmptyString(secondKeyPart, "secondKeyPart"); - - return Get(new[] { firstKeyPart, secondKeyPart }, defaultValue); - } - - /// <summary> - /// Get a configuration value for the given key parts. - /// <para> - /// For example in order to get the value for this in a .git\config file: - /// - /// <code> - /// [difftool "kdiff3"] - /// path = c:/Program Files/KDiff3/kdiff3.exe - /// </code> - /// - /// You would call: - /// - /// <code> - /// string where = repo.Config.Get<string>("difftool", "kdiff3", "path", null); - /// </code> - /// </para> - /// </summary> - /// <typeparam name = "T">The configuration value type</typeparam> - /// <param name = "firstKeyPart">The first key part</param> - /// <param name = "secondKeyPart">The second key part</param> - /// <param name = "thirdKeyPart">The third key part</param> - /// <param name = "defaultValue">The default value</param> - /// <returns>The configuration value, or <c>defaultValue</c> if not set</returns> - [Obsolete("This method will be removed in the next release. Please use a different overload instead.")] - public virtual T Get<T>(string firstKeyPart, string secondKeyPart, string thirdKeyPart, T defaultValue) - { - Ensure.ArgumentNotNullOrEmptyString(firstKeyPart, "firstKeyPart"); - Ensure.ArgumentNotNullOrEmptyString(secondKeyPart, "secondKeyPart"); - Ensure.ArgumentNotNullOrEmptyString(thirdKeyPart, "secondKeyPart"); - - return Get(new[] { firstKeyPart, secondKeyPart, thirdKeyPart }, defaultValue); - } - - /// <summary> - /// Get a configuration value for the given key parts. - /// <para> - /// For example in order to get the value for this in a .git\config file: - /// - /// <code> - /// [core] - /// bare = true - /// </code> - /// - /// You would call: - /// - /// <code> - /// bool isBare = repo.Config.Get<bool>(new []{ "core", "bare" }, false); - /// </code> - /// </para> - /// </summary> - /// <typeparam name = "T">The configuration value type</typeparam> - /// <param name = "keyParts">The key parts</param> - /// <param name = "defaultValue">The default value</param> - /// <returns>The configuration value, or <c>defaultValue</c> if not set</returns> - [Obsolete("This method will be removed in the next release. Please use a different overload instead.")] - public virtual T Get<T>(string[] keyParts, T defaultValue) - { - Ensure.ArgumentNotNull(keyParts, "keyParts"); - - return Get(string.Join(".", keyParts), defaultValue); - } - - /// <summary> - /// Get a configuration value for a key. Keys are in the form 'section.name'. - /// <para> - /// For example in order to get the value for this in a .git\config file: - /// - /// <code> - /// [core] - /// bare = true - /// </code> - /// - /// You would call: - /// - /// <code> /// bool isBare = repo.Config.Get<bool>("core.bare").Value; /// </code> /// </para> @@ -329,64 +192,6 @@ namespace LibGit2Sharp return Proxy.git_config_get_entry<T>(handle, key); } - /// <summary> - /// Get a configuration value for the given key parts. - /// <para> - /// For example in order to get the value for this in a .git\config file: - /// - /// <code> - /// [core] - /// bare = true - /// </code> - /// - /// You would call: - /// - /// <code> - /// bool isBare = repo.Config.Get<bool>(new []{ "core", "bare" }).Value; - /// </code> - /// </para> - /// </summary> - /// <typeparam name = "T">The configuration value type</typeparam> - /// <param name = "keyParts">The key parts</param> - /// <returns>The <see cref="ConfigurationEntry{T}"/>, or null if not set</returns> - public ConfigurationEntry<T> Get<T>(string[] keyParts) - { - Ensure.ArgumentNotNull(keyParts, "keyParts"); - - return Get<T>(string.Join(".", keyParts)); - } - - /// <summary> - /// Get a configuration value for the given key parts. - /// <para> - /// For example in order to get the value for this in a .git\config file: - /// - /// <code> - /// [difftool "kdiff3"] - /// path = c:/Program Files/KDiff3/kdiff3.exe - /// </code> - /// - /// You would call: - /// - /// <code> - /// string where = repo.Config.Get<string>("difftool", "kdiff3", "path").Value; - /// </code> - /// </para> - /// </summary> - /// <typeparam name = "T">The configuration value type</typeparam> - /// <param name = "firstKeyPart">The first key part</param> - /// <param name = "secondKeyPart">The second key part</param> - /// <param name = "thirdKeyPart">The third key part</param> - /// <returns>The <see cref="ConfigurationEntry{T}"/>, or null if not set</returns> - public ConfigurationEntry<T> Get<T>(string firstKeyPart, string secondKeyPart, string thirdKeyPart) - { - Ensure.ArgumentNotNullOrEmptyString(firstKeyPart, "firstKeyPart"); - Ensure.ArgumentNotNullOrEmptyString(secondKeyPart, "secondKeyPart"); - Ensure.ArgumentNotNullOrEmptyString(thirdKeyPart, "secondKeyPart"); - - return Get<T>(new[] { firstKeyPart, secondKeyPart, thirdKeyPart }); - } - private void Save() { Dispose(true); |