Merge branch 'master' of github.com:mono/mono
[mono.git] / mcs / class / System.Configuration / System.Configuration / InternalConfigurationHost.cs
index d782c91e75ffd79fb5bd8d4d7f395eac11f4f279..1219fcd99926776e632072f7c24381043c4b4d3a 100644 (file)
@@ -45,7 +45,7 @@ namespace System.Configuration
                
                public virtual object CreateDeprecatedConfigContext (string configPath)
                {
-                       throw new NotImplementedException ();
+                       return null;
                }
                
                public virtual void DeleteStream (string streamName)
@@ -166,6 +166,9 @@ namespace System.Configuration
 #if !TARGET_JVM
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                extern private static string get_bundled_machine_config ();
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               extern private static string get_bundled_app_config ();
 #endif
                
                public virtual Stream OpenStreamForRead (string streamName)
@@ -180,8 +183,18 @@ namespace System.Configuration
 #endif
                        }
 
+                       if (String.CompareOrdinal (streamName, AppDomain.CurrentDomain.SetupInformation.ConfigurationFile) == 0) {
+#if TARGET_JVM
+                               throw new NotImplementedException();
+#else
+                               string bundle = get_bundled_app_config ();
+                               if (bundle != null)
+                                       return new MemoryStream (System.Text.Encoding.UTF8.GetBytes (bundle));
+#endif
+                       }
+
                        if (!File.Exists (streamName))
-                               throw new ConfigurationException ("File '" + streamName + "' not found");
+                               return null;
                                
                        return new FileStream (streamName, FileMode.Open, FileAccess.Read);
                }
@@ -268,6 +281,7 @@ namespace System.Configuration
                public override void Init (IInternalConfigRoot root, params object[] hostInitParams)
                {
                        map = (ExeConfigurationFileMap) hostInitParams [0];
+                       level = (ConfigurationUserLevel) hostInitParams [1];
                }
                
                public override string GetStreamName (string configPath)