Files
2026-06-04 11:42:34 +02:00

67 lines
3.9 KiB
C#

using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Contexts;
namespace System.Runtime.Remoting.Proxies
{
/// <summary>Indicates that an object type requires a custom proxy.</summary>
// Token: 0x02000431 RID: 1073
[AttributeUsage(AttributeTargets.Class)]
[ComVisible(true)]
public class ProxyAttribute : Attribute, IContextAttribute
{
/// <summary>Creates either an uninitialized <see cref="T:System.MarshalByRefObject" /> or a transparent proxy, depending on whether the specified type can exist in the current context.</summary>
/// <returns>An uninitialized <see cref="T:System.MarshalByRefObject" /> or a transparent proxy.</returns>
/// <param name="serverType">The object type to create an instance of. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, Infrastructure" />
/// </PermissionSet>
// Token: 0x0600297D RID: 10621 RVA: 0x00085504 File Offset: 0x00083704
public virtual MarshalByRefObject CreateInstance(Type serverType)
{
RemotingProxy remotingProxy = new RemotingProxy(serverType, ChannelServices.CrossContextUrl, null);
return (MarshalByRefObject)remotingProxy.GetTransparentProxy();
}
/// <summary>Creates an instance of a remoting proxy for a remote object described by the specified <see cref="T:System.Runtime.Remoting.ObjRef" />, and located on the server.</summary>
/// <returns>The new instance of remoting proxy for the remote object that is described in the specified <see cref="T:System.Runtime.Remoting.ObjRef" />.</returns>
/// <param name="objRef">The object reference to the remote object for which to create a proxy. </param>
/// <param name="serverType">The type of the server where the remote object is located. </param>
/// <param name="serverObject">The server object. </param>
/// <param name="serverContext">The context in which the server object is located. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x0600297E RID: 10622 RVA: 0x0008552C File Offset: 0x0008372C
public virtual RealProxy CreateProxy(ObjRef objRef, Type serverType, object serverObject, Context serverContext)
{
return RemotingServices.GetRealProxy(RemotingServices.GetProxyForRemoteObject(objRef, serverType));
}
/// <summary>Gets properties for a new context.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x0600297F RID: 10623 RVA: 0x0008553C File Offset: 0x0008373C
[ComVisible(true)]
public void GetPropertiesForNewContext(IConstructionCallMessage msg)
{
}
/// <summary>Checks the specified context.</summary>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002980 RID: 10624 RVA: 0x00085540 File Offset: 0x00083740
[ComVisible(true)]
public bool IsContextOK(Context ctx, IConstructionCallMessage msg)
{
return true;
}
}
}