Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Triger <kostat@mono-cvs.ximian.com>2005-05-01 20:45:33 +0400
committerKonstantin Triger <kostat@mono-cvs.ximian.com>2005-05-01 20:45:33 +0400
commit29885394c059866fcc55503cab5938953277eabd (patch)
tree6d114eac3f5b691aac38a725a8d636ed7b45c175 /mcs/class/System.Data/System.Data.ProviderBase
parentf2778ad2f75a52268c779441b0197ad18039f127 (diff)
svn path=/branches/Mainsoft.System.Data/mcs/; revision=43844
Diffstat (limited to 'mcs/class/System.Data/System.Data.ProviderBase')
-rw-r--r--mcs/class/System.Data/System.Data.ProviderBase/DbStringManager.cs56
1 files changed, 56 insertions, 0 deletions
diff --git a/mcs/class/System.Data/System.Data.ProviderBase/DbStringManager.cs b/mcs/class/System.Data/System.Data.ProviderBase/DbStringManager.cs
new file mode 100644
index 00000000000..efc2cceaab7
--- /dev/null
+++ b/mcs/class/System.Data/System.Data.ProviderBase/DbStringManager.cs
@@ -0,0 +1,56 @@
+using java.util;
+
+namespace System.Data.Common
+{
+ public class DbStringManager
+ {
+ public DbStringManager(string bundleName)
+ {
+ _bundleName = bundleName;
+ _resourceBundle = ResourceBundle.getBundle(_bundleName);
+ }
+
+ private readonly string _bundleName;
+
+ private readonly ResourceBundle _resourceBundle;
+
+ public string GetString(string key)
+ {
+ try {
+ return _resourceBundle.getString(key);
+ }
+ catch (MissingResourceException) {
+ return null;
+ }
+ }
+
+ public string GetString(string key, string defaultValue)
+ {
+ try {
+ return _resourceBundle.getString(key);
+ }
+ catch (MissingResourceException) {
+ return defaultValue;
+ }
+ }
+
+
+ public string[] GetStringArray(String key)
+ {
+ try {
+ string tmp = _resourceBundle.getString(key);
+ java.util.StringTokenizer st = new java.util.StringTokenizer(tmp, ",");
+
+ String[] strArr = new String[st.countTokens()];
+
+ for (int i = 0; i < strArr.Length; i++) {
+ strArr[i] = st.nextToken();
+ }
+ return strArr;
+ }
+ catch (MissingResourceException) {
+ return null;
+ }
+ }
+ }
+}