You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2009/08/19 00:43:50 UTC

svn commit: r805613 - /incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs

Author: digy
Date: Tue Aug 18 22:43:50 2009
New Revision: 805613

URL: http://svn.apache.org/viewvc?rev=805613&view=rev
Log:
LUCENENET-190 SupportClass

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/SupportClass.cs?rev=805613&r1=805612&r2=805613&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs Tue Aug 18 22:43:50 2009
@@ -1138,6 +1138,17 @@
         /// <summary>
         /// 
         /// </summary>
+        /// <param name="Key"></param>
+        /// <param name="Value"></param>
+        public static void Set(System.String key, bool defValue)
+        {
+            settings[key] = defValue;
+            //System.Configuration.ConfigurationManager.AppSettings.Set(key, defValue); // {{Aroush-2.3.1}} try this instead
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
         /// <param name="key"></param>
         /// <param name="defValue"></param>
         /// <returns></returns>
@@ -1153,7 +1164,9 @@
             {
                 return defValue;
             }
-            return System.Convert.ToInt16(theValue.Trim());
+            int retValue = System.Convert.ToInt32(theValue.Trim());
+            settings[key] = retValue;
+            return retValue;
         }
 
         /// <summary>
@@ -1174,7 +1187,9 @@
             {
                 return defValue;
             }
-            return System.Convert.ToInt32(theValue.Trim());
+            long retValue = System.Convert.ToInt64(theValue.Trim());
+            settings[key] = retValue;
+            return retValue;
         }
 
         /// <summary>
@@ -1195,8 +1210,27 @@
             {
                 return defValue;
             }
+            settings[key] = theValue;
             return theValue;
         }
+
+        public static bool Get(System.String key, bool defValue)
+        {
+            if (settings[key] != null)
+            {
+                return (bool)settings[key];
+            }
+
+            System.String theValue = System.Configuration.ConfigurationManager.AppSettings.Get(key);
+            if (theValue == null)
+            {
+                return defValue;
+            }
+            bool retValue = System.Convert.ToBoolean(theValue.Trim());
+            settings[key] = retValue;
+            return retValue;
+        }
+
     }
 
     /// <summary>
@@ -1579,5 +1613,4 @@
     }
 
 
-
 }