202 lines
8.2 KiB
C#
202 lines
8.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace System.Runtime.Remoting.Messaging
|
|
{
|
|
/// <summary>Provides a set of properties that are carried with the execution code path. This class cannot be inherited.</summary>
|
|
// Token: 0x020003DE RID: 990
|
|
[ComVisible(true)]
|
|
[Serializable]
|
|
public sealed class CallContext
|
|
{
|
|
// Token: 0x060026C5 RID: 9925 RVA: 0x0007FEC0 File Offset: 0x0007E0C0
|
|
private CallContext()
|
|
{
|
|
}
|
|
|
|
/// <summary>Gets or sets the host context associated with the current thread.</summary>
|
|
/// <returns>The host context associated with the current thread.</returns>
|
|
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
|
|
// Token: 0x17000747 RID: 1863
|
|
// (get) Token: 0x060026C6 RID: 9926 RVA: 0x0007FEC8 File Offset: 0x0007E0C8
|
|
// (set) Token: 0x060026C7 RID: 9927 RVA: 0x0007FED0 File Offset: 0x0007E0D0
|
|
public static object HostContext
|
|
{
|
|
get
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
set
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
|
|
/// <summary>Empties a data slot with the specified name.</summary>
|
|
/// <param name="name">The name of the data slot to empty. </param>
|
|
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
|
|
/// </PermissionSet>
|
|
// Token: 0x060026C8 RID: 9928 RVA: 0x0007FED8 File Offset: 0x0007E0D8
|
|
public static void FreeNamedDataSlot(string name)
|
|
{
|
|
CallContext.Datastore.Remove(name);
|
|
}
|
|
|
|
/// <summary>Retrieves an object with the specified name from the <see cref="T:System.Runtime.Remoting.Messaging.CallContext" />.</summary>
|
|
/// <returns>The object in the call context associated with the specified name.</returns>
|
|
/// <param name="name">The name of the item in the call context. </param>
|
|
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
|
|
/// </PermissionSet>
|
|
// Token: 0x060026C9 RID: 9929 RVA: 0x0007FEE8 File Offset: 0x0007E0E8
|
|
public static object GetData(string name)
|
|
{
|
|
return CallContext.Datastore[name];
|
|
}
|
|
|
|
/// <summary>Stores a given object and associates it with the specified name.</summary>
|
|
/// <param name="name">The name with which to associate the new item in the call context. </param>
|
|
/// <param name="data">The object to store in the call context. </param>
|
|
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
|
|
/// </PermissionSet>
|
|
// Token: 0x060026CA RID: 9930 RVA: 0x0007FEF8 File Offset: 0x0007E0F8
|
|
public static void SetData(string name, object data)
|
|
{
|
|
CallContext.Datastore[name] = data;
|
|
}
|
|
|
|
/// <summary>Retrieves an object with the specified name from the logical call context.</summary>
|
|
/// <returns>The object in the logical call context associated with the specified name.</returns>
|
|
/// <param name="name">The name of the item in the logical call context. </param>
|
|
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
|
|
// Token: 0x060026CB RID: 9931 RVA: 0x0007FF08 File Offset: 0x0007E108
|
|
[MonoTODO]
|
|
public static object LogicalGetData(string name)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>Stores a given object in the logical call context and associates it with the specified name.</summary>
|
|
/// <param name="name">The name with which to associate the new item in the logical call context. </param>
|
|
/// <param name="data">The object to store in the logical call context. </param>
|
|
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
|
|
// Token: 0x060026CC RID: 9932 RVA: 0x0007FF10 File Offset: 0x0007E110
|
|
[MonoTODO]
|
|
public static void LogicalSetData(string name, object data)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>Returns the headers that are sent along with the method call.</summary>
|
|
/// <returns>The headers that are sent along with the method call.</returns>
|
|
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
|
|
/// </PermissionSet>
|
|
// Token: 0x060026CD RID: 9933 RVA: 0x0007FF18 File Offset: 0x0007E118
|
|
public static Header[] GetHeaders()
|
|
{
|
|
return CallContext.Headers;
|
|
}
|
|
|
|
/// <summary>Sets the headers that are sent along with the method call.</summary>
|
|
/// <param name="headers">A <see cref="T:System.Runtime.Remoting.Messaging.Header" /> array of the headers that are to be sent along with the method call. </param>
|
|
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have infrastructure permission. </exception>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
|
|
/// </PermissionSet>
|
|
// Token: 0x060026CE RID: 9934 RVA: 0x0007FF20 File Offset: 0x0007E120
|
|
public static void SetHeaders(Header[] headers)
|
|
{
|
|
CallContext.Headers = headers;
|
|
}
|
|
|
|
// Token: 0x060026CF RID: 9935 RVA: 0x0007FF28 File Offset: 0x0007E128
|
|
internal static LogicalCallContext CreateLogicalCallContext(bool createEmpty)
|
|
{
|
|
LogicalCallContext logicalCallContext = null;
|
|
if (CallContext.datastore != null)
|
|
{
|
|
foreach (object obj in CallContext.datastore)
|
|
{
|
|
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
|
|
if (dictionaryEntry.Value is ILogicalThreadAffinative)
|
|
{
|
|
if (logicalCallContext == null)
|
|
{
|
|
logicalCallContext = new LogicalCallContext();
|
|
}
|
|
logicalCallContext.SetData((string)dictionaryEntry.Key, dictionaryEntry.Value);
|
|
}
|
|
}
|
|
}
|
|
if (logicalCallContext == null && createEmpty)
|
|
{
|
|
return new LogicalCallContext();
|
|
}
|
|
return logicalCallContext;
|
|
}
|
|
|
|
// Token: 0x060026D0 RID: 9936 RVA: 0x0007FFE4 File Offset: 0x0007E1E4
|
|
internal static object SetCurrentCallContext(LogicalCallContext ctx)
|
|
{
|
|
object obj = CallContext.datastore;
|
|
if (ctx != null && ctx.HasInfo)
|
|
{
|
|
CallContext.datastore = (Hashtable)ctx.Datastore.Clone();
|
|
}
|
|
else
|
|
{
|
|
CallContext.datastore = null;
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
// Token: 0x060026D1 RID: 9937 RVA: 0x0008002C File Offset: 0x0007E22C
|
|
internal static void UpdateCurrentCallContext(LogicalCallContext ctx)
|
|
{
|
|
Hashtable hashtable = ctx.Datastore;
|
|
foreach (object obj in hashtable)
|
|
{
|
|
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
|
|
CallContext.SetData((string)dictionaryEntry.Key, dictionaryEntry.Value);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060026D2 RID: 9938 RVA: 0x000800B0 File Offset: 0x0007E2B0
|
|
internal static void RestoreCallContext(object oldContext)
|
|
{
|
|
CallContext.datastore = (Hashtable)oldContext;
|
|
}
|
|
|
|
// Token: 0x17000748 RID: 1864
|
|
// (get) Token: 0x060026D3 RID: 9939 RVA: 0x000800C0 File Offset: 0x0007E2C0
|
|
private static Hashtable Datastore
|
|
{
|
|
get
|
|
{
|
|
Hashtable hashtable = CallContext.datastore;
|
|
if (hashtable == null)
|
|
{
|
|
return CallContext.datastore = new Hashtable();
|
|
}
|
|
return hashtable;
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000F2C RID: 3884
|
|
[ThreadStatic]
|
|
private static Header[] Headers;
|
|
|
|
// Token: 0x04000F2D RID: 3885
|
|
[ThreadStatic]
|
|
private static Hashtable datastore;
|
|
}
|
|
}
|