Lucene.Net.Support.Configuration: Deleted Configuration.cs (not in use)
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/caded340 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/caded340 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/caded340 Branch: refs/heads/api-work Commit: caded3408ea605230c7b372e3c892420f7aea3d0 Parents: 1631768 Author: Shad Storhaug <[email protected]> Authored: Thu Apr 13 01:14:46 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Apr 13 01:14:46 2017 +0700 ---------------------------------------------------------------------- .../Support/RandomizedTest.cs | 3 +- .../Util/LuceneTestCase.cs | 1 - src/Lucene.Net/Lucene.Net.csproj | 1 - .../Support/Configuration/Configuration.cs | 69 -------------------- 4 files changed, 1 insertion(+), 73 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/caded340/src/Lucene.Net.TestFramework/Support/RandomizedTest.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Support/RandomizedTest.cs b/src/Lucene.Net.TestFramework/Support/RandomizedTest.cs index 71a826a..a24ee2f 100644 --- a/src/Lucene.Net.TestFramework/Support/RandomizedTest.cs +++ b/src/Lucene.Net.TestFramework/Support/RandomizedTest.cs @@ -1,5 +1,4 @@ -using Lucene.Net.Support.Configuration; -using NUnit.Framework; +using NUnit.Framework; namespace Lucene.Net.TestFramework.Support http://git-wip-us.apache.org/repos/asf/lucenenet/blob/caded340/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs index dc73e62..386b006 100644 --- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs +++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs @@ -37,7 +37,6 @@ using System.Reflection; namespace Lucene.Net.Util { using Lucene.Net.TestFramework.Support; - using Support.Configuration; using System.IO; using System.Reflection; using AlcoholicMergePolicy = Lucene.Net.Index.AlcoholicMergePolicy; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/caded340/src/Lucene.Net/Lucene.Net.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Lucene.Net.csproj b/src/Lucene.Net/Lucene.Net.csproj index 107f6c0..4c10951 100644 --- a/src/Lucene.Net/Lucene.Net.csproj +++ b/src/Lucene.Net/Lucene.Net.csproj @@ -629,7 +629,6 @@ <Compile Include="Support\Collections.cs" /> <Compile Include="Support\ConcurrentHashMapWrapper.cs" /> <Compile Include="Support\ConcurrentHashSet.cs" /> - <Compile Include="Support\Configuration\Configuration.cs" /> <Compile Include="Support\CultureContext.cs" /> <Compile Include="Support\DataInputStream.cs" /> <Compile Include="Support\DataOutputStream.cs" /> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/caded340/src/Lucene.Net/Support/Configuration/Configuration.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Support/Configuration/Configuration.cs b/src/Lucene.Net/Support/Configuration/Configuration.cs deleted file mode 100644 index ee9372d..0000000 --- a/src/Lucene.Net/Support/Configuration/Configuration.cs +++ /dev/null @@ -1,69 +0,0 @@ -#if NETSTANDARD -using Microsoft.Extensions.Configuration; -using System.IO; -using System.Reflection; -#else -using System.Configuration; -#endif - -namespace Lucene.Net.Support.Configuration -{ - public static class Configuration - { -#if NETSTANDARD - private static IConfigurationRoot _configuration; - - static Configuration() - { - var builder = new ConfigurationBuilder(); - var entryAssembly = Assembly.GetEntryAssembly(); - var configurationFiles = new string[0]; - - if (entryAssembly != null) - { - var directory = Path.GetDirectoryName(entryAssembly.Location); - configurationFiles = Directory.GetFiles(directory, "*.config"); - } - - foreach (var config in configurationFiles) - { - builder.AddConfigFile(config, false, new KeyValueParser()); - } - - _configuration = builder.Build(); - } -#endif - - public static string GetAppSetting(string key) - { -#if NETSTANDARD - - return _configuration.GetAppSetting(key); -#else - return ConfigurationManager.AppSettings[key]; -#endif - } - - public static string GetAppSetting(string key, string defaultValue) - { - string setting = GetAppSetting(key); - return string.IsNullOrEmpty(setting) ? defaultValue : setting; - } - - /// <summary> - /// Gets the value for the AppSetting with specified key. - /// If key is not present, default value is returned. - /// If key is present, value is converted to specified type based on the conversionFunction specified. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="key"></param> - /// <param name="conversionFunction"></param> - /// <param name="defaultValue"></param> - /// <returns></returns> - public static T GetProperty<T>(string key, T defaultValue, System.Func<string, T> conversionFunction) - { - string setting = GetAppSetting(key); - return string.IsNullOrEmpty(setting) ? defaultValue : conversionFunction(setting); - } - } -} \ No newline at end of file
