Files
Dec2017-Script-Dump/mscorlib/System/Runtime/Remoting/Messaging/LogicalCallContext.cs
T
2026-06-04 11:42:34 +02:00

158 lines
6.5 KiB
C#

using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Runtime.Remoting.Messaging
{
/// <summary>Provides a set of properties that are carried with the execution code path during remote method calls.</summary>
// Token: 0x020003F2 RID: 1010
[ComVisible(true)]
[Serializable]
public sealed class LogicalCallContext : ICloneable, ISerializable
{
// Token: 0x06002734 RID: 10036 RVA: 0x00080880 File Offset: 0x0007EA80
internal LogicalCallContext()
{
}
// Token: 0x06002735 RID: 10037 RVA: 0x00080894 File Offset: 0x0007EA94
internal LogicalCallContext(SerializationInfo info, StreamingContext context)
{
foreach (SerializationEntry serializationEntry in info)
{
if (serializationEntry.Name == "__RemotingData")
{
this._remotingData = (CallContextRemotingData)serializationEntry.Value;
}
else
{
this.SetData(serializationEntry.Name, serializationEntry.Value);
}
}
}
/// <summary>Gets a value indicating whether the current <see cref="T:System.Runtime.Remoting.Messaging.LogicalCallContext" /> contains information.</summary>
/// <returns>A Boolean value indicating whether the current <see cref="T:System.Runtime.Remoting.Messaging.LogicalCallContext" /> contains information.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x17000774 RID: 1908
// (get) Token: 0x06002736 RID: 10038 RVA: 0x00080914 File Offset: 0x0007EB14
public bool HasInfo
{
get
{
return this._data != null && this._data.Count > 0;
}
}
/// <summary>Empties a data slot with the specified name.</summary>
/// <param name="name">The name of the data slot to empty. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002737 RID: 10039 RVA: 0x00080934 File Offset: 0x0007EB34
public void FreeNamedDataSlot(string name)
{
if (this._data != null)
{
this._data.Remove(name);
}
}
/// <summary>Retrieves an object associated with the specified name from the current instance.</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 call context. </param>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x06002738 RID: 10040 RVA: 0x00080950 File Offset: 0x0007EB50
public object GetData(string name)
{
if (this._data != null)
{
return this._data[name];
}
return null;
}
/// <summary>Populates a specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the current <see cref="T:System.Runtime.Remoting.Messaging.LogicalCallContext" />.</summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
/// <param name="context">The contextual information about the source or destination of the serialization. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="info" /> is null. </exception>
/// <exception cref="T:System.Security.SecurityException">The immediate caller does not have SerializationFormatter permission. </exception>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter, Infrastructure" />
/// </PermissionSet>
// Token: 0x06002739 RID: 10041 RVA: 0x0008096C File Offset: 0x0007EB6C
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("__RemotingData", this._remotingData);
if (this._data != null)
{
foreach (object obj in this._data)
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
info.AddValue((string)dictionaryEntry.Key, dictionaryEntry.Value);
}
}
}
/// <summary>Stores the specified object in the current instance, 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>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x0600273A RID: 10042 RVA: 0x00080A0C File Offset: 0x0007EC0C
public void SetData(string name, object data)
{
if (this._data == null)
{
this._data = new Hashtable();
}
this._data[name] = data;
}
/// <summary>Creates a new object that is a copy of the current instance.</summary>
/// <returns>A new object that is a copy of this instance.</returns>
/// <PermissionSet>
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Infrastructure" />
/// </PermissionSet>
// Token: 0x0600273B RID: 10043 RVA: 0x00080A34 File Offset: 0x0007EC34
public object Clone()
{
LogicalCallContext logicalCallContext = new LogicalCallContext();
logicalCallContext._remotingData = (CallContextRemotingData)this._remotingData.Clone();
if (this._data != null)
{
logicalCallContext._data = new Hashtable();
foreach (object obj in this._data)
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
logicalCallContext._data[dictionaryEntry.Key] = dictionaryEntry.Value;
}
}
return logicalCallContext;
}
// Token: 0x17000775 RID: 1909
// (get) Token: 0x0600273C RID: 10044 RVA: 0x00080AE8 File Offset: 0x0007ECE8
internal Hashtable Datastore
{
get
{
return this._data;
}
}
// Token: 0x04000F43 RID: 3907
private Hashtable _data;
// Token: 0x04000F44 RID: 3908
private CallContextRemotingData _remotingData = new CallContextRemotingData();
}
}