23 using System.Configuration;
25 namespace Lucene.Net.Support
32 static System.Collections.Specialized.ListDictionary settings =
new System.Collections.Specialized.ListDictionary();
39 public static void Set(System.String key,
int defValue)
41 settings[key] = defValue;
49 public static void Set(System.String key,
long defValue)
51 settings[key] = defValue;
59 public static void Set(System.String key, System.String defValue)
61 settings[key] = defValue;
69 public static void Set(System.String key,
bool defValue)
71 settings[key] = defValue;
80 public static int Get(System.String key,
int defValue)
82 if (settings[key] != null)
84 return (
int)settings[key];
87 System.String theValue = ConfigurationManager.AppSettings.
Get(key);
92 int retValue = Convert.ToInt32(theValue.Trim());
93 settings[key] = retValue;
103 public static long Get(System.String key,
long defValue)
105 if (settings[key] != null)
107 return (
long)settings[key];
110 System.String theValue = ConfigurationManager.AppSettings.Get(key);
111 if (theValue == null)
115 long retValue = Convert.ToInt64(theValue.Trim());
116 settings[key] = retValue;
126 public static System.String Get(System.String key, System.String defValue)
128 if (settings[key] != null)
130 return (System.String)settings[key];
133 System.String theValue = ConfigurationManager.AppSettings.Get(key);
134 if (theValue == null)
138 settings[key] = theValue;
142 public static bool Get(System.String key,
bool defValue)
144 if (settings[key] != null)
146 return (
bool)settings[key];
149 System.String theValue = ConfigurationManager.AppSettings.Get(key);
150 if (theValue == null)
154 bool retValue = Convert.ToBoolean(theValue.Trim());
155 settings[key] = retValue;