//
// (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
+// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.Globalization;
using System.IO;
using System.Reflection;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
using System.Threading;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[ComDefaultInterface (typeof (_AppDomain))]
#endif
[ClassInterface(ClassInterfaceType.None)]
+ [StructLayout (LayoutKind.Sequential)]
#if MOONLIGHT
public sealed class AppDomain : _AppDomain {
#elif NET_2_1
public string BaseDirectory {
get {
string path = SetupInformationNoCopy.ApplicationBase;
+#if !NET_2_1
if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
// we cannot divulge local file informations
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
}
+#endif
return path;
}
}
public string RelativeSearchPath {
get {
string path = SetupInformationNoCopy.PrivateBinPath;
+#if !NET_2_1
if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
// we cannot divulge local file informations
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
}
+#endif
return path;
}
}
return null;
string path = Path.Combine (setup.DynamicBase, setup.ApplicationName);
+#if !NET_2_1
if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
// we cannot divulge local file informations
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
}
+#endif
return path;
}
}
{
return Activator.CreateComInstanceFrom (assemblyFile, typeName, hashValue ,hashAlgorithm);
}
+#endif
#endif
public ObjectHandle CreateInstance (string assemblyName, string typeName)
return (oh != null) ? oh.Unwrap () : null;
}
-#endif // !NET_2_1
-
+#if !FULL_AOT_RUNTIME
public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access)
{
return DefineDynamicAssembly (name, access, null, null, null, null, null, false);
{
return new AssemblyBuilder (name, null, access, true);
}
+#endif
//
// AppDomain.DoCallBack works because AppDomain is a MarshalByRefObject
string name;
+#if !FULL_AOT_RUNTIME
if (name_or_tb is TypeBuilder)
name = ((TypeBuilder) name_or_tb).FullName;
else
+#endif
name = (string) name_or_tb;
/* Prevent infinite recursion */
}
}
+ internal Assembly DoResourceResolve (string name, Assembly requesting) {
+ if (ResourceResolve == null)
+ return null;
+
+ Delegate[] invocation_list = ResourceResolve.GetInvocationList ();
+
+ foreach (Delegate eh in invocation_list) {
+ ResolveEventHandler handler = (ResolveEventHandler) eh;
+#if NET_4_0
+ Assembly assembly = handler (this, new ResolveEventArgs (name, requesting));
+#else
+ Assembly assembly = handler (this, new ResolveEventArgs (name));
+#endif
+ if (assembly != null)
+ return assembly;
+ }
+ return null;
+ }
+
private void DoDomainUnload ()
{
if (DomainUnload != null)
DomainUnload(this, null);
}
-#if !NET_2_1
internal byte[] GetMarshalledDomainObjRef ()
{
ObjRef oref = RemotingServices.Marshal (AppDomain.CurrentDomain, null, typeof (AppDomain));
return CADSerializer.SerializeObject (oref).GetBuffer();
}
-#endif
+
internal void ProcessMessageInDomain (byte[] arrRequest, CADMethodCallMessage cadMsg,
out byte[] arrResponse, out CADMethodReturnMessage cadMrm)
{