This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,600 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Lifetime;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using System.Threading;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Defines an environment for the objects that are resident inside it and for which a policy can be enforced.</summary>
// Token: 0x020003B8 RID: 952
[ComVisible(true)]
public class Context
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Remoting.Contexts.Context" /> class.</summary>
// Token: 0x060025E8 RID: 9704 RVA: 0x0007CF64 File Offset: 0x0007B164
public Context()
{
this.domain_id = Thread.GetDomainID();
this.context_id = 1 + Context.global_count++;
}
/// <summary>Cleans up the backing objects for the nondefault contexts.</summary>
// Token: 0x060025EA RID: 9706 RVA: 0x0007CFA4 File Offset: 0x0007B1A4
~Context()
{
}
/// <summary>Gets the default context for the current application domain.</summary>
/// <returns>The default context for the <see cref="T:System.AppDomain" /> namespace.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000715 RID: 1813
// (get) Token: 0x060025EB RID: 9707 RVA: 0x0007CFDC File Offset: 0x0007B1DC
public static Context DefaultContext
{
get
{
return AppDomain.InternalGetDefaultContext();
}
}
/// <summary>Gets the context ID for the current context.</summary>
/// <returns>The context ID for the current context.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000716 RID: 1814
// (get) Token: 0x060025EC RID: 9708 RVA: 0x0007CFE4 File Offset: 0x0007B1E4
public virtual int ContextID
{
get
{
return this.context_id;
}
}
/// <summary>Gets the array of the current context properties.</summary>
/// <returns>The current context properties array; otherwise, null if the context does not have any properties attributed to it.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000717 RID: 1815
// (get) Token: 0x060025ED RID: 9709 RVA: 0x0007CFEC File Offset: 0x0007B1EC
public virtual IContextProperty[] ContextProperties
{
get
{
if (this.context_properties == null)
{
return new IContextProperty[0];
}
return (IContextProperty[])this.context_properties.ToArray(typeof(IContextProperty[]));
}
}
// Token: 0x17000718 RID: 1816
// (get) Token: 0x060025EE RID: 9710 RVA: 0x0007D028 File Offset: 0x0007B228
internal bool IsDefaultContext
{
get
{
return this.context_id == 0;
}
}
// Token: 0x17000719 RID: 1817
// (get) Token: 0x060025EF RID: 9711 RVA: 0x0007D034 File Offset: 0x0007B234
internal bool NeedsContextSink
{
get
{
return this.context_id != 0 || (Context.global_dynamic_properties != null && Context.global_dynamic_properties.HasProperties) || (this.context_dynamic_properties != null && this.context_dynamic_properties.HasProperties);
}
}
/// <summary>Registers a dynamic property implementing the <see cref="T:System.Runtime.Remoting.Contexts.IDynamicProperty" /> interface with the remoting service.</summary>
/// <returns>true if the property was successfully registered; otherwise, false.</returns>
/// <param name="prop">The dynamic property to register. </param>
/// <param name="obj">The object/proxy for which the <paramref name="property" /> is registered. </param>
/// <param name="ctx">The context for which the <paramref name="property" /> is registered. </param>
/// <exception cref="T:System.ArgumentNullException">Either <paramref name="prop" /> or its name is null, or it is not dynamic (it does not implement <see cref="T:System.Runtime.Remoting.Contexts.IDynamicProperty" />). </exception>
/// <exception cref="T:System.ArgumentException">Both an object as well as a context are specified (both <paramref name="obj" /> and <paramref name="ctx" /> are not null). </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x060025F0 RID: 9712 RVA: 0x0007D084 File Offset: 0x0007B284
public static bool RegisterDynamicProperty(IDynamicProperty prop, ContextBoundObject obj, Context ctx)
{
DynamicPropertyCollection dynamicPropertyCollection = Context.GetDynamicPropertyCollection(obj, ctx);
return dynamicPropertyCollection.RegisterDynamicProperty(prop);
}
/// <summary>Unregisters a dynamic property implementing the <see cref="T:System.Runtime.Remoting.Contexts.IDynamicProperty" /> interface.</summary>
/// <returns>true if the object was successfully unregistered; otherwise, false.</returns>
/// <param name="name">The name of the dynamic property to unregister. </param>
/// <param name="obj">The object/proxy for which the <paramref name="property" /> is registered. </param>
/// <param name="ctx">The context for which the <paramref name="property" /> is registered. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.ArgumentException">Both an object as well as a context are specified (both <paramref name="obj" /> and <paramref name="ctx" /> are not null). </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x060025F1 RID: 9713 RVA: 0x0007D0A0 File Offset: 0x0007B2A0
public static bool UnregisterDynamicProperty(string name, ContextBoundObject obj, Context ctx)
{
DynamicPropertyCollection dynamicPropertyCollection = Context.GetDynamicPropertyCollection(obj, ctx);
return dynamicPropertyCollection.UnregisterDynamicProperty(name);
}
// Token: 0x060025F2 RID: 9714 RVA: 0x0007D0BC File Offset: 0x0007B2BC
private static DynamicPropertyCollection GetDynamicPropertyCollection(ContextBoundObject obj, Context ctx)
{
if (ctx == null && obj != null)
{
if (RemotingServices.IsTransparentProxy(obj))
{
RealProxy realProxy = RemotingServices.GetRealProxy(obj);
return realProxy.ObjectIdentity.ClientDynamicProperties;
}
return obj.ObjectIdentity.ServerDynamicProperties;
}
else
{
if (ctx != null && obj == null)
{
if (ctx.context_dynamic_properties == null)
{
ctx.context_dynamic_properties = new DynamicPropertyCollection();
}
return ctx.context_dynamic_properties;
}
if (ctx == null && obj == null)
{
if (Context.global_dynamic_properties == null)
{
Context.global_dynamic_properties = new DynamicPropertyCollection();
}
return Context.global_dynamic_properties;
}
throw new ArgumentException("Either obj or ctx must be null");
}
}
// Token: 0x060025F3 RID: 9715 RVA: 0x0007D158 File Offset: 0x0007B358
internal static void NotifyGlobalDynamicSinks(bool start, IMessage req_msg, bool client_site, bool async)
{
if (Context.global_dynamic_properties != null && Context.global_dynamic_properties.HasProperties)
{
Context.global_dynamic_properties.NotifyMessage(start, req_msg, client_site, async);
}
}
// Token: 0x1700071A RID: 1818
// (get) Token: 0x060025F4 RID: 9716 RVA: 0x0007D184 File Offset: 0x0007B384
internal static bool HasGlobalDynamicSinks
{
get
{
return Context.global_dynamic_properties != null && Context.global_dynamic_properties.HasProperties;
}
}
// Token: 0x060025F5 RID: 9717 RVA: 0x0007D1A0 File Offset: 0x0007B3A0
internal void NotifyDynamicSinks(bool start, IMessage req_msg, bool client_site, bool async)
{
if (this.context_dynamic_properties != null && this.context_dynamic_properties.HasProperties)
{
this.context_dynamic_properties.NotifyMessage(start, req_msg, client_site, async);
}
}
// Token: 0x1700071B RID: 1819
// (get) Token: 0x060025F6 RID: 9718 RVA: 0x0007D1D0 File Offset: 0x0007B3D0
internal bool HasDynamicSinks
{
get
{
return this.context_dynamic_properties != null && this.context_dynamic_properties.HasProperties;
}
}
// Token: 0x1700071C RID: 1820
// (get) Token: 0x060025F7 RID: 9719 RVA: 0x0007D1EC File Offset: 0x0007B3EC
internal bool HasExitSinks
{
get
{
return !(this.GetClientContextSinkChain() is ClientContextTerminatorSink) || this.HasDynamicSinks || Context.HasGlobalDynamicSinks;
}
}
/// <summary>Returns a specific context property, specified by name.</summary>
/// <returns>The specified context property.</returns>
/// <param name="name">The name of the property. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x060025F8 RID: 9720 RVA: 0x0007D214 File Offset: 0x0007B414
public virtual IContextProperty GetProperty(string name)
{
if (this.context_properties == null)
{
return null;
}
foreach (object obj in this.context_properties)
{
IContextProperty contextProperty = (IContextProperty)obj;
if (contextProperty.Name == name)
{
return contextProperty;
}
}
return null;
}
/// <summary>Sets a specific context property by name.</summary>
/// <param name="prop">The actual context property. </param>
/// <exception cref="T:System.InvalidOperationException">There is an attempt to add properties to the default context. </exception>
/// <exception cref="T:System.InvalidOperationException">The context is frozen. </exception>
/// <exception cref="T:System.ArgumentNullException">The property or the property name is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x060025F9 RID: 9721 RVA: 0x0007D2A4 File Offset: 0x0007B4A4
public virtual void SetProperty(IContextProperty prop)
{
if (prop == null)
{
throw new ArgumentNullException("IContextProperty");
}
if (this == Context.DefaultContext)
{
throw new InvalidOperationException("Can not add properties to default context");
}
if (this.frozen)
{
throw new InvalidOperationException("Context is Frozen");
}
if (this.context_properties == null)
{
this.context_properties = new ArrayList();
}
this.context_properties.Add(prop);
}
/// <summary>Freezes the context, making it impossible to add or remove context properties from the current context.</summary>
/// <exception cref="T:System.InvalidOperationException">The context is already frozen. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x060025FA RID: 9722 RVA: 0x0007D314 File Offset: 0x0007B514
public virtual void Freeze()
{
if (this.context_properties != null)
{
foreach (object obj in this.context_properties)
{
IContextProperty contextProperty = (IContextProperty)obj;
contextProperty.Freeze(this);
}
}
}
/// <summary>Returns a <see cref="T:System.String" /> class representation of the current context.</summary>
/// <returns>A <see cref="T:System.String" /> class representation of the current context.</returns>
// Token: 0x060025FB RID: 9723 RVA: 0x0007D390 File Offset: 0x0007B590
public override string ToString()
{
return "ContextID: " + this.context_id;
}
// Token: 0x060025FC RID: 9724 RVA: 0x0007D3A8 File Offset: 0x0007B5A8
internal IMessageSink GetServerContextSinkChain()
{
if (this.server_context_sink_chain == null)
{
if (Context.default_server_context_sink == null)
{
Context.default_server_context_sink = new ServerContextTerminatorSink();
}
this.server_context_sink_chain = Context.default_server_context_sink;
if (this.context_properties != null)
{
for (int i = this.context_properties.Count - 1; i >= 0; i--)
{
IContributeServerContextSink contributeServerContextSink = this.context_properties[i] as IContributeServerContextSink;
if (contributeServerContextSink != null)
{
this.server_context_sink_chain = contributeServerContextSink.GetServerContextSink(this.server_context_sink_chain);
}
}
}
}
return this.server_context_sink_chain;
}
// Token: 0x060025FD RID: 9725 RVA: 0x0007D438 File Offset: 0x0007B638
internal IMessageSink GetClientContextSinkChain()
{
if (this.client_context_sink_chain == null)
{
this.client_context_sink_chain = new ClientContextTerminatorSink(this);
if (this.context_properties != null)
{
foreach (object obj in this.context_properties)
{
IContextProperty contextProperty = (IContextProperty)obj;
IContributeClientContextSink contributeClientContextSink = contextProperty as IContributeClientContextSink;
if (contributeClientContextSink != null)
{
this.client_context_sink_chain = contributeClientContextSink.GetClientContextSink(this.client_context_sink_chain);
}
}
}
}
return this.client_context_sink_chain;
}
// Token: 0x060025FE RID: 9726 RVA: 0x0007D4E8 File Offset: 0x0007B6E8
internal IMessageSink CreateServerObjectSinkChain(MarshalByRefObject obj, bool forceInternalExecute)
{
IMessageSink messageSink = new StackBuilderSink(obj, forceInternalExecute);
messageSink = new ServerObjectTerminatorSink(messageSink);
messageSink = new LeaseSink(messageSink);
if (this.context_properties != null)
{
for (int i = this.context_properties.Count - 1; i >= 0; i--)
{
IContextProperty contextProperty = (IContextProperty)this.context_properties[i];
IContributeObjectSink contributeObjectSink = contextProperty as IContributeObjectSink;
if (contributeObjectSink != null)
{
messageSink = contributeObjectSink.GetObjectSink(obj, messageSink);
}
}
}
return messageSink;
}
// Token: 0x060025FF RID: 9727 RVA: 0x0007D560 File Offset: 0x0007B760
internal IMessageSink CreateEnvoySink(MarshalByRefObject serverObject)
{
IMessageSink messageSink = EnvoyTerminatorSink.Instance;
if (this.context_properties != null)
{
foreach (object obj in this.context_properties)
{
IContextProperty contextProperty = (IContextProperty)obj;
IContributeEnvoySink contributeEnvoySink = contextProperty as IContributeEnvoySink;
if (contributeEnvoySink != null)
{
messageSink = contributeEnvoySink.GetEnvoySink(serverObject, messageSink);
}
}
}
return messageSink;
}
// Token: 0x06002600 RID: 9728 RVA: 0x0007D5F4 File Offset: 0x0007B7F4
internal static Context SwitchToContext(Context newContext)
{
return AppDomain.InternalSetContext(newContext);
}
// Token: 0x06002601 RID: 9729 RVA: 0x0007D5FC File Offset: 0x0007B7FC
internal static Context CreateNewContext(IConstructionCallMessage msg)
{
Context context = new Context();
foreach (object obj in msg.ContextProperties)
{
IContextProperty contextProperty = (IContextProperty)obj;
if (context.GetProperty(contextProperty.Name) == null)
{
context.SetProperty(contextProperty);
}
}
context.Freeze();
foreach (object obj2 in msg.ContextProperties)
{
IContextProperty contextProperty2 = (IContextProperty)obj2;
if (!contextProperty2.IsNewContextOK(context))
{
throw new RemotingException("A context property did not approve the candidate context for activating the object");
}
}
return context;
}
/// <summary>Executes code in another context.</summary>
/// <param name="deleg">The delegate used to request the callback. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002602 RID: 9730 RVA: 0x0007D704 File Offset: 0x0007B904
public void DoCallBack(CrossContextDelegate deleg)
{
lock (this)
{
if (this.callback_object == null)
{
Context context = Context.SwitchToContext(this);
this.callback_object = new ContextCallbackObject();
Context.SwitchToContext(context);
}
}
this.callback_object.DoCallBack(deleg);
}
/// <summary>Allocates an unnamed data slot.</summary>
/// <returns>A local data slot.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002603 RID: 9731 RVA: 0x0007D774 File Offset: 0x0007B974
public static LocalDataStoreSlot AllocateDataSlot()
{
return new LocalDataStoreSlot(false);
}
/// <summary>Allocates a named data slot.</summary>
/// <returns>A local data slot object.</returns>
/// <param name="name">The required name for the data slot. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002604 RID: 9732 RVA: 0x0007D77C File Offset: 0x0007B97C
public static LocalDataStoreSlot AllocateNamedDataSlot(string name)
{
object syncRoot = Context.namedSlots.SyncRoot;
LocalDataStoreSlot localDataStoreSlot2;
lock (syncRoot)
{
LocalDataStoreSlot localDataStoreSlot = Context.AllocateDataSlot();
Context.namedSlots.Add(name, localDataStoreSlot);
localDataStoreSlot2 = localDataStoreSlot;
}
return localDataStoreSlot2;
}
/// <summary>Frees a named data slot on all the contexts.</summary>
/// <param name="name">The name of the data slot to free. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002605 RID: 9733 RVA: 0x0007D7DC File Offset: 0x0007B9DC
public static void FreeNamedDataSlot(string name)
{
object syncRoot = Context.namedSlots.SyncRoot;
lock (syncRoot)
{
Context.namedSlots.Remove(name);
}
}
/// <summary>Retrieves the value from the specified slot on the current context.</summary>
/// <returns>Returns the data associated with <paramref name="slot" />. </returns>
/// <param name="slot">The data slot that contains the data. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002606 RID: 9734 RVA: 0x0007D830 File Offset: 0x0007BA30
public static object GetData(LocalDataStoreSlot slot)
{
Context currentContext = Thread.CurrentContext;
Context context = currentContext;
object obj;
lock (context)
{
if (currentContext.datastore != null && slot.slot < currentContext.datastore.Length)
{
obj = currentContext.datastore[slot.slot];
}
else
{
obj = null;
}
}
return obj;
}
/// <summary>Looks up a named data slot.</summary>
/// <returns>Returns a local data slot.</returns>
/// <param name="name">The data slot name. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002607 RID: 9735 RVA: 0x0007D8AC File Offset: 0x0007BAAC
public static LocalDataStoreSlot GetNamedDataSlot(string name)
{
object syncRoot = Context.namedSlots.SyncRoot;
LocalDataStoreSlot localDataStoreSlot2;
lock (syncRoot)
{
LocalDataStoreSlot localDataStoreSlot = Context.namedSlots[name] as LocalDataStoreSlot;
if (localDataStoreSlot == null)
{
localDataStoreSlot2 = Context.AllocateNamedDataSlot(name);
}
else
{
localDataStoreSlot2 = localDataStoreSlot;
}
}
return localDataStoreSlot2;
}
/// <summary>Sets the data in the specified slot on the current context.</summary>
/// <param name="slot">The data slot where the data is to be added. </param>
/// <param name="data">The data that is to be added. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002608 RID: 9736 RVA: 0x0007D920 File Offset: 0x0007BB20
public static void SetData(LocalDataStoreSlot slot, object data)
{
Context currentContext = Thread.CurrentContext;
Context context = currentContext;
lock (context)
{
if (currentContext.datastore == null)
{
currentContext.datastore = new object[slot.slot + 2];
}
else if (slot.slot >= currentContext.datastore.Length)
{
object[] array = new object[slot.slot + 2];
currentContext.datastore.CopyTo(array, 0);
currentContext.datastore = array;
}
currentContext.datastore[slot.slot] = data;
}
}
// Token: 0x04000ECB RID: 3787
private int domain_id;
// Token: 0x04000ECC RID: 3788
private int context_id;
// Token: 0x04000ECD RID: 3789
private UIntPtr static_data;
// Token: 0x04000ECE RID: 3790
private static IMessageSink default_server_context_sink;
// Token: 0x04000ECF RID: 3791
private IMessageSink server_context_sink_chain;
// Token: 0x04000ED0 RID: 3792
private IMessageSink client_context_sink_chain;
// Token: 0x04000ED1 RID: 3793
private object[] datastore;
// Token: 0x04000ED2 RID: 3794
private ArrayList context_properties;
// Token: 0x04000ED3 RID: 3795
private bool frozen;
// Token: 0x04000ED4 RID: 3796
private static int global_count;
// Token: 0x04000ED5 RID: 3797
private static Hashtable namedSlots = new Hashtable();
// Token: 0x04000ED6 RID: 3798
private static DynamicPropertyCollection global_dynamic_properties;
// Token: 0x04000ED7 RID: 3799
private DynamicPropertyCollection context_dynamic_properties;
// Token: 0x04000ED8 RID: 3800
private ContextCallbackObject callback_object;
}
}
@@ -0,0 +1,144 @@
using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Activation;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Provides the default implementations of the <see cref="T:System.Runtime.Remoting.Contexts.IContextAttribute" /> and <see cref="T:System.Runtime.Remoting.Contexts.IContextProperty" /> interfaces.</summary>
// Token: 0x020003BC RID: 956
[ComVisible(true)]
[AttributeUsage(AttributeTargets.Class)]
[Serializable]
public class ContextAttribute : Attribute, IContextAttribute, IContextProperty
{
/// <summary>Creates an instance of the <see cref="T:System.Runtime.Remoting.Contexts.ContextAttribute" /> class with the specified name.</summary>
/// <param name="name">The name of the context attribute. </param>
// Token: 0x06002612 RID: 9746 RVA: 0x0007DC80 File Offset: 0x0007BE80
public ContextAttribute(string name)
{
this.AttributeName = name;
}
/// <summary>Gets the name of the context attribute.</summary>
/// <returns>The name of the context attribute.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x1700071E RID: 1822
// (get) Token: 0x06002613 RID: 9747 RVA: 0x0007DC90 File Offset: 0x0007BE90
public virtual string Name
{
get
{
return this.AttributeName;
}
}
/// <summary>Returns a Boolean value indicating whether this instance is equal to the specified object.</summary>
/// <returns>true if <paramref name="o" /> is not null and if the object names are equivalent; otherwise, false.</returns>
/// <param name="o">The object to compare with this instance. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002614 RID: 9748 RVA: 0x0007DC98 File Offset: 0x0007BE98
public override bool Equals(object o)
{
if (o == null)
{
return false;
}
if (!(o is ContextAttribute))
{
return false;
}
ContextAttribute contextAttribute = (ContextAttribute)o;
return !(contextAttribute.AttributeName != this.AttributeName);
}
/// <summary>Called when the context is frozen.</summary>
/// <param name="newContext">The context to freeze. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002615 RID: 9749 RVA: 0x0007DCDC File Offset: 0x0007BEDC
public virtual void Freeze(Context newContext)
{
}
/// <summary>Returns the hashcode for this instance of <see cref="T:System.Runtime.Remoting.Contexts.ContextAttribute" />.</summary>
/// <returns>The hashcode for this instance of <see cref="T:System.Runtime.Remoting.Contexts.ContextAttribute" />.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002616 RID: 9750 RVA: 0x0007DCE0 File Offset: 0x0007BEE0
public override int GetHashCode()
{
if (this.AttributeName == null)
{
return 0;
}
return this.AttributeName.GetHashCode();
}
/// <summary>Adds the current context property to the given message.</summary>
/// <param name="ctorMsg">The <see cref="T:System.Runtime.Remoting.Activation.IConstructionCallMessage" /> to which to add the context property. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="ctorMsg" /> parameter is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002617 RID: 9751 RVA: 0x0007DCFC File Offset: 0x0007BEFC
public virtual void GetPropertiesForNewContext(IConstructionCallMessage ctorMsg)
{
if (ctorMsg == null)
{
throw new ArgumentNullException("ctorMsg");
}
IList contextProperties = ctorMsg.ContextProperties;
contextProperties.Add(this);
}
/// <summary>Returns a Boolean value indicating whether the context parameter meets the context attribute's requirements.</summary>
/// <returns>true if the passed in context is okay; otherwise, false.</returns>
/// <param name="ctx">The context in which to check. </param>
/// <param name="ctorMsg">The <see cref="T:System.Runtime.Remoting.Activation.IConstructionCallMessage" /> to which to add the context property.</param>
/// <exception cref="T:System.ArgumentNullException">Either <paramref name="ctx" /> or <paramref name="ctorMsg" /> is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002618 RID: 9752 RVA: 0x0007DD2C File Offset: 0x0007BF2C
public virtual bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg)
{
if (ctorMsg == null)
{
throw new ArgumentNullException("ctorMsg");
}
if (ctx == null)
{
throw new ArgumentNullException("ctx");
}
if (!ctorMsg.ActivationType.IsContextful)
{
return true;
}
IContextProperty property = ctx.GetProperty(this.AttributeName);
return property != null && this == property;
}
/// <summary>Returns a Boolean value indicating whether the context property is compatible with the new context.</summary>
/// <returns>true if the context property is okay with the new context; otherwise, false.</returns>
/// <param name="newCtx">The new context in which the property has been created. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002619 RID: 9753 RVA: 0x0007DD8C File Offset: 0x0007BF8C
public virtual bool IsNewContextOK(Context newCtx)
{
return true;
}
/// <summary>Indicates the name of the context attribute.</summary>
// Token: 0x04000EDC RID: 3804
protected string AttributeName;
}
}
@@ -0,0 +1,13 @@
using System;
namespace System.Runtime.Remoting.Contexts
{
// Token: 0x020003BB RID: 955
internal class ContextCallbackObject : ContextBoundObject
{
// Token: 0x06002611 RID: 9745 RVA: 0x0007DC7C File Offset: 0x0007BE7C
public void DoCallBack(CrossContextDelegate deleg)
{
}
}
}
@@ -0,0 +1,51 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Holds the name/value pair of the property name and the object representing the property of a context.</summary>
// Token: 0x020003BD RID: 957
[ComVisible(true)]
public class ContextProperty
{
// Token: 0x0600261A RID: 9754 RVA: 0x0007DD90 File Offset: 0x0007BF90
private ContextProperty(string name, object prop)
{
this.name = name;
this.prop = prop;
}
/// <summary>Gets the name of the T:System.Runtime.Remoting.Contexts.ContextProperty class.</summary>
/// <returns>The name of the <see cref="T:System.Runtime.Remoting.Contexts.ContextProperty" /> class.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x1700071F RID: 1823
// (get) Token: 0x0600261B RID: 9755 RVA: 0x0007DDA8 File Offset: 0x0007BFA8
public virtual string Name
{
get
{
return this.name;
}
}
/// <summary>Gets the object representing the property of a context.</summary>
/// <returns>The object representing the property of a context.</returns>
// Token: 0x17000720 RID: 1824
// (get) Token: 0x0600261C RID: 9756 RVA: 0x0007DDB0 File Offset: 0x0007BFB0
public virtual object Property
{
get
{
return this.prop;
}
}
// Token: 0x04000EDD RID: 3805
private string name;
// Token: 0x04000EDE RID: 3806
private object prop;
}
}
@@ -0,0 +1,157 @@
using System;
using System.Runtime.Remoting.Messaging;
using System.Threading;
namespace System.Runtime.Remoting.Contexts
{
// Token: 0x020003BE RID: 958
internal class CrossContextChannel : IMessageSink
{
// Token: 0x0600261E RID: 9758 RVA: 0x0007DDC0 File Offset: 0x0007BFC0
public IMessage SyncProcessMessage(IMessage msg)
{
ServerIdentity serverIdentity = (ServerIdentity)RemotingServices.GetMessageTargetIdentity(msg);
Context context = null;
if (Thread.CurrentContext != serverIdentity.Context)
{
context = Context.SwitchToContext(serverIdentity.Context);
}
IMessage message;
try
{
Context.NotifyGlobalDynamicSinks(true, msg, false, false);
Thread.CurrentContext.NotifyDynamicSinks(true, msg, false, false);
message = serverIdentity.Context.GetServerContextSinkChain().SyncProcessMessage(msg);
Context.NotifyGlobalDynamicSinks(false, msg, false, false);
Thread.CurrentContext.NotifyDynamicSinks(false, msg, false, false);
}
catch (Exception ex)
{
message = new ReturnMessage(ex, (IMethodCallMessage)msg);
}
finally
{
if (context != null)
{
Context.SwitchToContext(context);
}
}
return message;
}
// Token: 0x0600261F RID: 9759 RVA: 0x0007DE94 File Offset: 0x0007C094
public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
{
ServerIdentity serverIdentity = (ServerIdentity)RemotingServices.GetMessageTargetIdentity(msg);
Context context = null;
if (Thread.CurrentContext != serverIdentity.Context)
{
context = Context.SwitchToContext(serverIdentity.Context);
}
IMessageCtrl messageCtrl2;
try
{
Context.NotifyGlobalDynamicSinks(true, msg, false, true);
Thread.CurrentContext.NotifyDynamicSinks(true, msg, false, false);
if (replySink != null)
{
replySink = new CrossContextChannel.ContextRestoreSink(replySink, context, msg);
}
IMessageCtrl messageCtrl = serverIdentity.AsyncObjectProcessMessage(msg, replySink);
if (replySink == null)
{
Context.NotifyGlobalDynamicSinks(false, msg, false, false);
Thread.CurrentContext.NotifyDynamicSinks(false, msg, false, false);
}
messageCtrl2 = messageCtrl;
}
catch (Exception ex)
{
if (replySink != null)
{
replySink.SyncProcessMessage(new ReturnMessage(ex, (IMethodCallMessage)msg));
}
messageCtrl2 = null;
}
finally
{
if (context != null)
{
Context.SwitchToContext(context);
}
}
return messageCtrl2;
}
// Token: 0x17000721 RID: 1825
// (get) Token: 0x06002620 RID: 9760 RVA: 0x0007DF90 File Offset: 0x0007C190
public IMessageSink NextSink
{
get
{
return null;
}
}
// Token: 0x020003BF RID: 959
private class ContextRestoreSink : IMessageSink
{
// Token: 0x06002621 RID: 9761 RVA: 0x0007DF94 File Offset: 0x0007C194
public ContextRestoreSink(IMessageSink next, Context context, IMessage call)
{
this._next = next;
this._context = context;
this._call = call;
}
// Token: 0x06002622 RID: 9762 RVA: 0x0007DFB4 File Offset: 0x0007C1B4
public IMessage SyncProcessMessage(IMessage msg)
{
IMessage message;
try
{
Context.NotifyGlobalDynamicSinks(false, msg, false, false);
Thread.CurrentContext.NotifyDynamicSinks(false, msg, false, false);
message = this._next.SyncProcessMessage(msg);
}
catch (Exception ex)
{
message = new ReturnMessage(ex, (IMethodCallMessage)this._call);
}
finally
{
if (this._context != null)
{
Context.SwitchToContext(this._context);
}
}
return message;
}
// Token: 0x06002623 RID: 9763 RVA: 0x0007E05C File Offset: 0x0007C25C
public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
{
throw new NotSupportedException();
}
// Token: 0x17000722 RID: 1826
// (get) Token: 0x06002624 RID: 9764 RVA: 0x0007E064 File Offset: 0x0007C264
public IMessageSink NextSink
{
get
{
return this._next;
}
}
// Token: 0x04000EDF RID: 3807
private IMessageSink _next;
// Token: 0x04000EE0 RID: 3808
private Context _context;
// Token: 0x04000EE1 RID: 3809
private IMessage _call;
}
}
}
@@ -0,0 +1,11 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Represents the method that will handle the requests of execution of some code in another context.</summary>
// Token: 0x020006D9 RID: 1753
// (Invoke) Token: 0x060041EC RID: 16876
[ComVisible(true)]
public delegate void CrossContextDelegate();
}
@@ -0,0 +1,116 @@
using System;
using System.Collections;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Contexts
{
// Token: 0x020003B9 RID: 953
internal class DynamicPropertyCollection
{
// Token: 0x1700071D RID: 1821
// (get) Token: 0x0600260A RID: 9738 RVA: 0x0007D9E0 File Offset: 0x0007BBE0
public bool HasProperties
{
get
{
return this._properties.Count > 0;
}
}
// Token: 0x0600260B RID: 9739 RVA: 0x0007D9F0 File Offset: 0x0007BBF0
public bool RegisterDynamicProperty(IDynamicProperty prop)
{
bool flag;
lock (this)
{
if (this.FindProperty(prop.Name) != -1)
{
throw new InvalidOperationException("Another property by this name already exists");
}
ArrayList arrayList = new ArrayList(this._properties);
DynamicPropertyCollection.DynamicPropertyReg dynamicPropertyReg = new DynamicPropertyCollection.DynamicPropertyReg();
dynamicPropertyReg.Property = prop;
IContributeDynamicSink contributeDynamicSink = prop as IContributeDynamicSink;
if (contributeDynamicSink != null)
{
dynamicPropertyReg.Sink = contributeDynamicSink.GetDynamicSink();
}
arrayList.Add(dynamicPropertyReg);
this._properties = arrayList;
flag = true;
}
return flag;
}
// Token: 0x0600260C RID: 9740 RVA: 0x0007DA98 File Offset: 0x0007BC98
public bool UnregisterDynamicProperty(string name)
{
bool flag;
lock (this)
{
int num = this.FindProperty(name);
if (num == -1)
{
throw new RemotingException("A property with the name " + name + " was not found");
}
this._properties.RemoveAt(num);
flag = true;
}
return flag;
}
// Token: 0x0600260D RID: 9741 RVA: 0x0007DB10 File Offset: 0x0007BD10
public void NotifyMessage(bool start, IMessage msg, bool client_site, bool async)
{
ArrayList properties = this._properties;
if (start)
{
foreach (object obj in properties)
{
DynamicPropertyCollection.DynamicPropertyReg dynamicPropertyReg = (DynamicPropertyCollection.DynamicPropertyReg)obj;
if (dynamicPropertyReg.Sink != null)
{
dynamicPropertyReg.Sink.ProcessMessageStart(msg, client_site, async);
}
}
}
else
{
foreach (object obj2 in properties)
{
DynamicPropertyCollection.DynamicPropertyReg dynamicPropertyReg2 = (DynamicPropertyCollection.DynamicPropertyReg)obj2;
if (dynamicPropertyReg2.Sink != null)
{
dynamicPropertyReg2.Sink.ProcessMessageFinish(msg, client_site, async);
}
}
}
}
// Token: 0x0600260E RID: 9742 RVA: 0x0007DC18 File Offset: 0x0007BE18
private int FindProperty(string name)
{
for (int i = 0; i < this._properties.Count; i++)
{
if (((DynamicPropertyCollection.DynamicPropertyReg)this._properties[i]).Property.Name == name)
{
return i;
}
}
return -1;
}
// Token: 0x04000ED9 RID: 3801
private ArrayList _properties = new ArrayList();
// Token: 0x020003BA RID: 954
private class DynamicPropertyReg
{
// Token: 0x04000EDA RID: 3802
public IDynamicProperty Property;
// Token: 0x04000EDB RID: 3803
public IDynamicMessageSink Sink;
}
}
}
@@ -0,0 +1,24 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Activation;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Identifies a context attribute.</summary>
// Token: 0x020003C0 RID: 960
[ComVisible(true)]
public interface IContextAttribute
{
/// <summary>Returns context properties to the caller in the given message.</summary>
/// <param name="msg">The <see cref="T:System.Runtime.Remoting.Activation.IConstructionCallMessage" /> to which to add the context properties. </param>
// Token: 0x06002625 RID: 9765
void GetPropertiesForNewContext(IConstructionCallMessage msg);
/// <summary>Returns a Boolean value indicating whether the specified context meets the context attribute's requirements.</summary>
/// <returns>true if the passed in context is okay; otherwise, false.</returns>
/// <param name="ctx">The context to check against the current context attribute. </param>
/// <param name="msg">The construction call, parameters of which need to be checked against the current context. </param>
// Token: 0x06002626 RID: 9766
bool IsContextOK(Context ctx, IConstructionCallMessage msg);
}
}
@@ -0,0 +1,34 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Gathers naming information from the context property and determines whether the new context is ok for the context property.</summary>
// Token: 0x020003C1 RID: 961
[ComVisible(true)]
public interface IContextProperty
{
/// <summary>Gets the name of the property under which it will be added to the context.</summary>
/// <returns>The name of the property.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000723 RID: 1827
// (get) Token: 0x06002627 RID: 9767
string Name { get; }
/// <summary>Called when the context is frozen.</summary>
/// <param name="newContext">The context to freeze. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002628 RID: 9768
void Freeze(Context newContext);
/// <summary>Returns a Boolean value indicating whether the context property is compatible with the new context.</summary>
/// <returns>true if the context property can coexist with the other context properties in the given context; otherwise, false.</returns>
/// <param name="newCtx">The new context in which the <see cref="T:System.Runtime.Remoting.Contexts.ContextProperty" /> has been created. </param>
// Token: 0x06002629 RID: 9769
bool IsNewContextOK(Context newCtx);
}
}
@@ -0,0 +1,40 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Activation;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Indicates that the implementing property is interested in participating in activation and might not have provided a message sink.</summary>
// Token: 0x020003C2 RID: 962
[ComVisible(true)]
public interface IContextPropertyActivator
{
/// <summary>Called on each client context property that has this interface, before the construction request leaves the client.</summary>
/// <param name="msg">An <see cref="T:System.Runtime.Remoting.Activation.IConstructionCallMessage" />. </param>
// Token: 0x0600262A RID: 9770
void CollectFromClientContext(IConstructionCallMessage msg);
/// <summary>Called on each server context property that has this interface, before the construction response leaves the server for the client.</summary>
/// <param name="msg">An <see cref="T:System.Runtime.Remoting.Activation.IConstructionReturnMessage" />. </param>
// Token: 0x0600262B RID: 9771
void CollectFromServerContext(IConstructionReturnMessage msg);
/// <summary>Called on each client context property that has this interface, when the construction request returns to the client from the server.</summary>
/// <returns>true if successful; otherwise, false.</returns>
/// <param name="msg">An <see cref="T:System.Runtime.Remoting.Activation.IConstructionCallMessage" />. </param>
// Token: 0x0600262C RID: 9772
bool DeliverClientContextToServerContext(IConstructionCallMessage msg);
/// <summary>Called on each client context property that has this interface, when the construction request returns to the client from the server.</summary>
/// <returns>true if successful; otherwise, false.</returns>
/// <param name="msg">An <see cref="T:System.Runtime.Remoting.Activation.IConstructionReturnMessage" />. </param>
// Token: 0x0600262D RID: 9773
bool DeliverServerContextToClientContext(IConstructionReturnMessage msg);
/// <summary>Indicates whether it is all right to activate the object type indicated in the <paramref name="msg" /> parameter.</summary>
/// <returns>A Boolean value indicating whether the requested type can be activated.</returns>
/// <param name="msg">An <see cref="T:System.Runtime.Remoting.Activation.IConstructionCallMessage" />. </param>
// Token: 0x0600262E RID: 9774
bool IsOKToActivate(IConstructionCallMessage msg);
}
}
@@ -0,0 +1,18 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Contributes an interception sink at the context boundary on the client end of a remoting call.</summary>
// Token: 0x020003C3 RID: 963
[ComVisible(true)]
public interface IContributeClientContextSink
{
/// <summary>Takes the first sink in the chain of sinks composed so far, and then chains its message sink in front of the chain already formed.</summary>
/// <returns>The composite sink chain.</returns>
/// <param name="nextSink">The chain of sinks composed so far. </param>
// Token: 0x0600262F RID: 9775
IMessageSink GetClientContextSink(IMessageSink nextSink);
}
}
@@ -0,0 +1,19 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Indicates that the implementing property will be registered at runtime through the <see cref="M:System.Runtime.Remoting.Contexts.Context.RegisterDynamicProperty(System.Runtime.Remoting.Contexts.IDynamicProperty,System.ContextBoundObject,System.Runtime.Remoting.Contexts.Context)" /> method.</summary>
// Token: 0x020003C4 RID: 964
[ComVisible(true)]
public interface IContributeDynamicSink
{
/// <summary>Returns the message sink that will be notified of call start and finish events through the <see cref="T:System.Runtime.Remoting.Contexts.IDynamicMessageSink" /> interface.</summary>
/// <returns>A dynamic sink that exposes the <see cref="T:System.Runtime.Remoting.Contexts.IDynamicMessageSink" /> interface.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002630 RID: 9776
IDynamicMessageSink GetDynamicSink();
}
}
@@ -0,0 +1,19 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Contributes an envoy message sink on the client end.</summary>
// Token: 0x020003C5 RID: 965
[ComVisible(true)]
public interface IContributeEnvoySink
{
/// <summary>Takes the first sink in the chain of sinks composed so far, and then chains its message sink in front of the chain already formed.</summary>
/// <returns>The composite sink chain.</returns>
/// <param name="obj">The server object for which the chain is being created. </param>
/// <param name="nextSink">The chain of sinks composed so far. </param>
// Token: 0x06002631 RID: 9777
IMessageSink GetEnvoySink(MarshalByRefObject obj, IMessageSink nextSink);
}
}
@@ -0,0 +1,19 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Contributes an object-specific interception sink on the server end of a remoting call.</summary>
// Token: 0x020003C6 RID: 966
[ComVisible(true)]
public interface IContributeObjectSink
{
/// <summary>Chains the message sink of the provided server object in front of the given sink chain.</summary>
/// <returns>The composite sink chain.</returns>
/// <param name="obj">The server object which provides the message sink that is to be chained in front of the given chain. </param>
/// <param name="nextSink">The chain of sinks composed so far. </param>
// Token: 0x06002632 RID: 9778
IMessageSink GetObjectSink(MarshalByRefObject obj, IMessageSink nextSink);
}
}
@@ -0,0 +1,18 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Contributes an interception sink at the context boundary on the server end of a remoting call.</summary>
// Token: 0x020003C7 RID: 967
[ComVisible(true)]
public interface IContributeServerContextSink
{
/// <summary>Takes the first sink in the chain of sinks composed so far, and then chains its message sink in front of the chain already formed.</summary>
/// <returns>The composite sink chain.</returns>
/// <param name="nextSink">The chain of sinks composed so far. </param>
// Token: 0x06002633 RID: 9779
IMessageSink GetServerContextSink(IMessageSink nextSink);
}
}
@@ -0,0 +1,26 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Indicates that the implementing message sink will be provided by dynamically registered properties.</summary>
// Token: 0x020003C8 RID: 968
[ComVisible(true)]
public interface IDynamicMessageSink
{
/// <summary>Indicates that a call is returning.</summary>
/// <param name="replyMsg">A reply message. </param>
/// <param name="bCliSide">A value of true if the method is invoked on the client side and false if it is invoked on the server side. </param>
/// <param name="bAsync">A value of true if this is an asynchronic call and false if it is a synchronic call. </param>
// Token: 0x06002634 RID: 9780
void ProcessMessageFinish(IMessage replyMsg, bool bCliSide, bool bAsync);
/// <summary>Indicates that a call is starting.</summary>
/// <param name="reqMsg">A request message. </param>
/// <param name="bCliSide">A value of true if the method is invoked on the client side and false if the method is on the server side. </param>
/// <param name="bAsync">A value of true if this is an asynchronic call and false if it is a synchronic call. </param>
// Token: 0x06002635 RID: 9781
void ProcessMessageStart(IMessage reqMsg, bool bCliSide, bool bAsync);
}
}
@@ -0,0 +1,20 @@
using System;
using System.Runtime.InteropServices;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Indicates that the implementing property should be registered at runtime through the <see cref="M:System.Runtime.Remoting.Contexts.Context.RegisterDynamicProperty(System.Runtime.Remoting.Contexts.IDynamicProperty,System.ContextBoundObject,System.Runtime.Remoting.Contexts.Context)" /> method.</summary>
// Token: 0x020003C9 RID: 969
[ComVisible(true)]
public interface IDynamicProperty
{
/// <summary>Gets the name of the dynamic property.</summary>
/// <returns>The name of the dynamic property.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000724 RID: 1828
// (get) Token: 0x06002636 RID: 9782
string Name { get; }
}
}
@@ -0,0 +1,274 @@
using System;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Activation;
using System.Runtime.Remoting.Messaging;
using System.Threading;
namespace System.Runtime.Remoting.Contexts
{
/// <summary>Enforces a synchronization domain for the current context and all contexts that share the same instance.</summary>
// Token: 0x020003CA RID: 970
[AttributeUsage(AttributeTargets.Class)]
[ComVisible(true)]
[Serializable]
public class SynchronizationAttribute : ContextAttribute, IContributeClientContextSink, IContributeServerContextSink
{
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Remoting.Contexts.SynchronizationAttribute" /> class with default values.</summary>
// Token: 0x06002637 RID: 9783 RVA: 0x0007E06C File Offset: 0x0007C26C
public SynchronizationAttribute()
: this(8, false)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Remoting.Contexts.SynchronizationAttribute" /> class with a Boolean value indicating whether reentry is required.</summary>
/// <param name="reEntrant">A Boolean value indicating whether reentry is required. </param>
// Token: 0x06002638 RID: 9784 RVA: 0x0007E078 File Offset: 0x0007C278
public SynchronizationAttribute(bool reEntrant)
: this(8, reEntrant)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Remoting.Contexts.SynchronizationAttribute" /> class with a flag indicating the behavior of the object to which this attribute is applied.</summary>
/// <param name="flag">An integer value indicating the behavior of the object to which this attribute is applied. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="flag" /> parameter was not one of the defined flags. </exception>
// Token: 0x06002639 RID: 9785 RVA: 0x0007E084 File Offset: 0x0007C284
public SynchronizationAttribute(int flag)
: this(flag, false)
{
}
/// <summary>Initializes a new instance of the <see cref="T:System.Runtime.Remoting.Contexts.SynchronizationAttribute" /> class with a flag indicating the behavior of the object to which this attribute is applied, and a Boolean value indicating whether reentry is required.</summary>
/// <param name="flag">An integer value indicating the behavior of the object to which this attribute is applied. </param>
/// <param name="reEntrant">true if reentry is required, and callouts must be intercepted and serialized; otherwise, false. </param>
/// <exception cref="T:System.ArgumentException">The <paramref name="flag" /> parameter was not one of the defined flags. </exception>
// Token: 0x0600263A RID: 9786 RVA: 0x0007E090 File Offset: 0x0007C290
public SynchronizationAttribute(int flag, bool reEntrant)
: base("Synchronization")
{
if (flag != 1 && flag != 4 && flag != 8 && flag != 2)
{
throw new ArgumentException("flag");
}
this._bReEntrant = reEntrant;
this._flavor = flag;
}
/// <summary>Gets or sets a Boolean value indicating whether reentry is required.</summary>
/// <returns>A Boolean value indicating whether reentry is required.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000725 RID: 1829
// (get) Token: 0x0600263B RID: 9787 RVA: 0x0007E0EC File Offset: 0x0007C2EC
public virtual bool IsReEntrant
{
get
{
return this._bReEntrant;
}
}
/// <summary>Gets or sets a Boolean value indicating whether the <see cref="T:System.Runtime.Remoting.Contexts.Context" /> implementing this instance of <see cref="T:System.Runtime.Remoting.Contexts.SynchronizationAttribute" /> is locked.</summary>
/// <returns>A Boolean value indicating whether the <see cref="T:System.Runtime.Remoting.Contexts.Context" /> implementing this instance of <see cref="T:System.Runtime.Remoting.Contexts.SynchronizationAttribute" /> is locked.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000726 RID: 1830
// (get) Token: 0x0600263C RID: 9788 RVA: 0x0007E0F4 File Offset: 0x0007C2F4
// (set) Token: 0x0600263D RID: 9789 RVA: 0x0007E0FC File Offset: 0x0007C2FC
public virtual bool Locked
{
get
{
return this._locked;
}
set
{
if (value)
{
this._mutex.WaitOne();
lock (this)
{
this._lockCount++;
if (this._lockCount > 1)
{
this.ReleaseLock();
}
this._ownerThread = Thread.CurrentThread;
}
}
else
{
lock (this)
{
while (this._lockCount > 0 && this._ownerThread == Thread.CurrentThread)
{
this._lockCount--;
this._mutex.ReleaseMutex();
this._ownerThread = null;
}
}
}
}
}
// Token: 0x0600263E RID: 9790 RVA: 0x0007E1E8 File Offset: 0x0007C3E8
internal void AcquireLock()
{
this._mutex.WaitOne();
lock (this)
{
this._ownerThread = Thread.CurrentThread;
this._lockCount++;
}
}
// Token: 0x0600263F RID: 9791 RVA: 0x0007E24C File Offset: 0x0007C44C
internal void ReleaseLock()
{
lock (this)
{
if (this._lockCount > 0 && this._ownerThread == Thread.CurrentThread)
{
this._lockCount--;
this._mutex.ReleaseMutex();
this._ownerThread = null;
}
}
}
/// <summary>Adds the Synchronized context property to the specified <see cref="T:System.Runtime.Remoting.Activation.IConstructionCallMessage" />.</summary>
/// <param name="ctorMsg">The <see cref="T:System.Runtime.Remoting.Activation.IConstructionCallMessage" /> to which to add the property. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002640 RID: 9792 RVA: 0x0007E2C8 File Offset: 0x0007C4C8
[ComVisible(true)]
public override void GetPropertiesForNewContext(IConstructionCallMessage ctorMsg)
{
if (this._flavor != 1)
{
ctorMsg.ContextProperties.Add(this);
}
}
/// <summary>Creates a CallOut sink and chains it in front of the provided chain of sinks at the context boundary on the client end of a remoting call.</summary>
/// <returns>The composite sink chain with the new CallOut sink.</returns>
/// <param name="nextSink">The chain of sinks composed so far. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002641 RID: 9793 RVA: 0x0007E2E4 File Offset: 0x0007C4E4
public virtual IMessageSink GetClientContextSink(IMessageSink nextSink)
{
return new SynchronizedClientContextSink(nextSink, this);
}
/// <summary>Creates a synchronized dispatch sink and chains it in front of the provided chain of sinks at the context boundary on the server end of a remoting call.</summary>
/// <returns>The composite sink chain with the new synchronized dispatch sink.</returns>
/// <param name="nextSink">The chain of sinks composed so far. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002642 RID: 9794 RVA: 0x0007E2F0 File Offset: 0x0007C4F0
public virtual IMessageSink GetServerContextSink(IMessageSink nextSink)
{
return new SynchronizedServerContextSink(nextSink, this);
}
/// <summary>Returns a Boolean value indicating whether the context parameter meets the context attribute's requirements.</summary>
/// <returns>true if the passed in context is OK; otherwise, false.</returns>
/// <param name="ctx">The context to check. </param>
/// <param name="msg">Information gathered at construction time of the context bound object marked by this attribute. The <see cref="T:System.Runtime.Remoting.Contexts.SynchronizationAttribute" /> can inspect, add to, and remove properties from the context while determining if the context is acceptable to it. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="ctx" /> or <paramref name="msg" /> parameter is null. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002643 RID: 9795 RVA: 0x0007E2FC File Offset: 0x0007C4FC
[ComVisible(true)]
public override bool IsContextOK(Context ctx, IConstructionCallMessage msg)
{
SynchronizationAttribute synchronizationAttribute = ctx.GetProperty("Synchronization") as SynchronizationAttribute;
switch (this._flavor)
{
case 1:
return synchronizationAttribute == null;
case 2:
return true;
case 4:
return synchronizationAttribute != null;
case 8:
return false;
}
return false;
}
// Token: 0x06002644 RID: 9796 RVA: 0x0007E360 File Offset: 0x0007C560
internal static void ExitContext()
{
if (Thread.CurrentContext.IsDefaultContext)
{
return;
}
SynchronizationAttribute synchronizationAttribute = Thread.CurrentContext.GetProperty("Synchronization") as SynchronizationAttribute;
if (synchronizationAttribute == null)
{
return;
}
synchronizationAttribute.Locked = false;
}
// Token: 0x06002645 RID: 9797 RVA: 0x0007E3A0 File Offset: 0x0007C5A0
internal static void EnterContext()
{
if (Thread.CurrentContext.IsDefaultContext)
{
return;
}
SynchronizationAttribute synchronizationAttribute = Thread.CurrentContext.GetProperty("Synchronization") as SynchronizationAttribute;
if (synchronizationAttribute == null)
{
return;
}
synchronizationAttribute.Locked = true;
}
/// <summary>Indicates that the class to which this attribute is applied cannot be created in a context that has synchronization. This field is constant.</summary>
// Token: 0x04000EE2 RID: 3810
public const int NOT_SUPPORTED = 1;
/// <summary>Indicates that the class to which this attribute is applied is not dependent on whether the context has synchronization. This field is constant.</summary>
// Token: 0x04000EE3 RID: 3811
public const int SUPPORTED = 2;
/// <summary>Indicates that the class to which this attribute is applied must be created in a context that has synchronization. This field is constant.</summary>
// Token: 0x04000EE4 RID: 3812
public const int REQUIRED = 4;
/// <summary>Indicates that the class to which this attribute is applied must be created in a context with a new instance of the synchronization property each time. This field is constant.</summary>
// Token: 0x04000EE5 RID: 3813
public const int REQUIRES_NEW = 8;
// Token: 0x04000EE6 RID: 3814
private bool _bReEntrant;
// Token: 0x04000EE7 RID: 3815
private int _flavor;
// Token: 0x04000EE8 RID: 3816
[NonSerialized]
private bool _locked;
// Token: 0x04000EE9 RID: 3817
[NonSerialized]
private int _lockCount;
// Token: 0x04000EEA RID: 3818
[NonSerialized]
private Mutex _mutex = new Mutex(false);
// Token: 0x04000EEB RID: 3819
[NonSerialized]
private Thread _ownerThread;
}
}
@@ -0,0 +1,65 @@
using System;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Contexts
{
// Token: 0x020003CB RID: 971
internal class SynchronizedClientContextSink : IMessageSink
{
// Token: 0x06002646 RID: 9798 RVA: 0x0007E3E0 File Offset: 0x0007C5E0
public SynchronizedClientContextSink(IMessageSink next, SynchronizationAttribute att)
{
this._att = att;
this._next = next;
}
// Token: 0x17000727 RID: 1831
// (get) Token: 0x06002647 RID: 9799 RVA: 0x0007E3F8 File Offset: 0x0007C5F8
public IMessageSink NextSink
{
get
{
return this._next;
}
}
// Token: 0x06002648 RID: 9800 RVA: 0x0007E400 File Offset: 0x0007C600
public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
{
if (this._att.IsReEntrant)
{
this._att.ReleaseLock();
replySink = new SynchronizedContextReplySink(replySink, this._att, true);
}
return this._next.AsyncProcessMessage(msg, replySink);
}
// Token: 0x06002649 RID: 9801 RVA: 0x0007E444 File Offset: 0x0007C644
public IMessage SyncProcessMessage(IMessage msg)
{
if (this._att.IsReEntrant)
{
this._att.ReleaseLock();
}
IMessage message;
try
{
message = this._next.SyncProcessMessage(msg);
}
finally
{
if (this._att.IsReEntrant)
{
this._att.AcquireLock();
}
}
return message;
}
// Token: 0x04000EEC RID: 3820
private IMessageSink _next;
// Token: 0x04000EED RID: 3821
private SynchronizationAttribute _att;
}
}
@@ -0,0 +1,68 @@
using System;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Contexts
{
// Token: 0x020003CD RID: 973
internal class SynchronizedContextReplySink : IMessageSink
{
// Token: 0x0600264E RID: 9806 RVA: 0x0007E560 File Offset: 0x0007C760
public SynchronizedContextReplySink(IMessageSink next, SynchronizationAttribute att, bool newLock)
{
this._newLock = newLock;
this._next = next;
this._att = att;
}
// Token: 0x17000729 RID: 1833
// (get) Token: 0x0600264F RID: 9807 RVA: 0x0007E580 File Offset: 0x0007C780
public IMessageSink NextSink
{
get
{
return this._next;
}
}
// Token: 0x06002650 RID: 9808 RVA: 0x0007E588 File Offset: 0x0007C788
public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
{
throw new NotSupportedException();
}
// Token: 0x06002651 RID: 9809 RVA: 0x0007E590 File Offset: 0x0007C790
public IMessage SyncProcessMessage(IMessage msg)
{
if (this._newLock)
{
this._att.AcquireLock();
}
else
{
this._att.ReleaseLock();
}
IMessage message;
try
{
message = this._next.SyncProcessMessage(msg);
}
finally
{
if (this._newLock)
{
this._att.ReleaseLock();
}
}
return message;
}
// Token: 0x04000EF0 RID: 3824
private IMessageSink _next;
// Token: 0x04000EF1 RID: 3825
private bool _newLock;
// Token: 0x04000EF2 RID: 3826
private SynchronizationAttribute _att;
}
}
@@ -0,0 +1,56 @@
using System;
using System.Runtime.Remoting.Messaging;
namespace System.Runtime.Remoting.Contexts
{
// Token: 0x020003CC RID: 972
internal class SynchronizedServerContextSink : IMessageSink
{
// Token: 0x0600264A RID: 9802 RVA: 0x0007E4BC File Offset: 0x0007C6BC
public SynchronizedServerContextSink(IMessageSink next, SynchronizationAttribute att)
{
this._att = att;
this._next = next;
}
// Token: 0x17000728 RID: 1832
// (get) Token: 0x0600264B RID: 9803 RVA: 0x0007E4D4 File Offset: 0x0007C6D4
public IMessageSink NextSink
{
get
{
return this._next;
}
}
// Token: 0x0600264C RID: 9804 RVA: 0x0007E4DC File Offset: 0x0007C6DC
public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
{
this._att.AcquireLock();
replySink = new SynchronizedContextReplySink(replySink, this._att, false);
return this._next.AsyncProcessMessage(msg, replySink);
}
// Token: 0x0600264D RID: 9805 RVA: 0x0007E508 File Offset: 0x0007C708
public IMessage SyncProcessMessage(IMessage msg)
{
this._att.AcquireLock();
IMessage message;
try
{
message = this._next.SyncProcessMessage(msg);
}
finally
{
this._att.ReleaseLock();
}
return message;
}
// Token: 0x04000EEE RID: 3822
private IMessageSink _next;
// Token: 0x04000EEF RID: 3823
private SynchronizationAttribute _att;
}
}