//
using System;
+using System.Globalization;
using System.IO;
using System.Reflection;
using System.Collections;
namespace System.Runtime.Remoting
{
- public class RemotingConfiguration
+ [System.Runtime.InteropServices.ComVisible (true)]
+ public static class RemotingConfiguration
{
- //
- // Private constructor: nobody instantiates this.
- //
- private RemotingConfiguration ()
- {
- }
static string applicationID = null;
static string applicationName = null;
- static string configFile = "";
- static SmallXmlParser parser = null;
+// static string configFile = "";
+// static SmallXmlParser parser = null;
static string processGuid = null;
static bool defaultConfigRead = false;
static bool defaultDelayedConfigRead = false;
public static string ApplicationId
{
get
- {
- applicationID = AppDomain.CurrentDomain.SetupInformation.ApplicationName;
+ {
+ applicationID = ApplicationName;
return applicationID;
}
}
public static string ApplicationName
{
- get {
- try {
- applicationName = AppDomain.CurrentDomain.SetupInformation.ApplicationName;
- }
- catch (Exception e) {
- throw e;
- }
- // We return null if the application name has not been set.
- return null;
- }
+ get { return applicationName; }
set { applicationName = value; }
}
-
+
+ [MonoTODO]
+ public static CustomErrorsModes CustomErrorsMode
+ {
+ get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
+ }
+
public static string ProcessId
{
get {
// public methods
- public static void Configure (string filename)
+ [MonoTODO ("ensureSecurity support has not been implemented")]
+ public static void Configure (string filename, bool ensureSecurity)
{
- lock (channelTemplates)
- {
- if (!defaultConfigRead)
- {
+ lock (channelTemplates) {
+ if (!defaultConfigRead) {
ReadConfigFile (Environment.GetMachineConfigPath ());
defaultConfigRead = true;
}
-
+
if (filename != null)
ReadConfigFile (filename);
}
}
+ [Obsolete ("Use Configure(String,Boolean)")]
+ public static void Configure (string filename)
+ {
+ Configure (filename, false);
+ }
+
private static void ReadConfigFile (string filename)
{
try
}
catch (Exception ex)
{
- throw new RemotingException ("Configuration file '" + filename + "' could not be loaded: " + ex.Message);
+ throw new RemotingException ("Configuration file '" + filename + "' could not be loaded: " + ex.Message, ex);
}
}
}
}
- public static bool IsActivationAllowed (Type serverType)
+ public static bool IsActivationAllowed (Type svrType)
{
lock (channelTemplates)
{
- return activatedServiceEntries.ContainsKey (serverType);
+ return activatedServiceEntries.ContainsKey (svrType);
}
}
- public static ActivatedClientTypeEntry IsRemotelyActivatedClientType (Type serviceType)
+ public static ActivatedClientTypeEntry IsRemotelyActivatedClientType (Type svrType)
{
lock (channelTemplates)
{
- return activatedClientEntries [serviceType] as ActivatedClientTypeEntry;
+ return activatedClientEntries [svrType] as ActivatedClientTypeEntry;
}
}
return IsRemotelyActivatedClientType (Assembly.Load(assemblyName).GetType (typeName));
}
- public static WellKnownClientTypeEntry IsWellKnownClientType (Type serviceType)
+ public static WellKnownClientTypeEntry IsWellKnownClientType (Type svrType)
{
lock (channelTemplates)
{
- return wellKnownClientEntries [serviceType] as WellKnownClientTypeEntry;
+ return wellKnownClientEntries [svrType] as WellKnownClientTypeEntry;
}
}
}
}
- public static void RegisterWellKnownServiceType (Type type, string objectUrl, WellKnownObjectMode mode)
+ public static void RegisterWellKnownServiceType (Type type, string objectUri, WellKnownObjectMode mode)
{
- RegisterWellKnownServiceType (new WellKnownServiceTypeEntry (type, objectUrl, mode));
+ RegisterWellKnownServiceType (new WellKnownServiceTypeEntry (type, objectUri, mode));
}
public static void RegisterWellKnownServiceType (WellKnownServiceTypeEntry entry)
internal static void SetCustomErrorsMode (string mode)
{
- if (mode != "on" && mode != "off" && mode != "remoteOnly")
+ if (mode == null)
+ throw new RemotingException ("mode attribute is required");
+
+ // the mode is case insensitive
+ string m = mode.ToLower ();
+
+ if (m != "on" && m != "off" && m != "remoteonly")
throw new RemotingException ("Invalid custom error mode: " + mode);
- _errorMode = mode;
+ _errorMode = m;
}
}
bool CheckPath (string path)
{
- if (path.StartsWith ("/"))
+ CompareInfo ci = CultureInfo.InvariantCulture.CompareInfo;
+ if (ci.IsPrefix (path, "/", CompareOptions.Ordinal))
return path == currentXmlPath;
else
- return currentXmlPath.EndsWith (path);
+ return ci.IsSuffix (currentXmlPath, path, CompareOptions.Ordinal);
}
public void OnStartParsing (SmallXmlParser parser) {}
}
catch (Exception ex)
{
- throw new RemotingException ("Error in element " + name + ": " + ex.Message);
+ throw new RemotingException ("Error in element " + name + ": " + ex.Message, ex);
}
}
if (currentProviderData != null)
{
currentProviderData.Pop ();
- if (currentProviderData.Count > 0) return;
- currentProviderData = null;
+ if (currentProviderData.Count == 0)
+ currentProviderData = null;
}
currentXmlPath = currentXmlPath.Substring (0, currentXmlPath.Length - name.Length - 1);