using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
namespace System.Threading
{
/// Provides methods for setting and capturing the compressed stack on the current thread. This class cannot be inherited.
/// 2
// Token: 0x0200060B RID: 1547
[Serializable]
public sealed class CompressedStack : ISerializable
{
// Token: 0x0600388F RID: 14479 RVA: 0x000C3D7C File Offset: 0x000C1F7C
internal CompressedStack(int length)
{
if (length > 0)
{
this._list = new ArrayList(length);
}
}
// Token: 0x06003890 RID: 14480 RVA: 0x000C3D98 File Offset: 0x000C1F98
internal CompressedStack(CompressedStack cs)
{
if (cs != null && cs._list != null)
{
this._list = (ArrayList)cs._list.Clone();
}
}
/// Creates a copy of the current compressed stack.
/// A object representing the current compressed stack.
/// 2
// Token: 0x06003891 RID: 14481 RVA: 0x000C3DC8 File Offset: 0x000C1FC8
[ComVisible(false)]
public CompressedStack CreateCopy()
{
return new CompressedStack(this);
}
/// Captures the compressed stack from the current thread.
/// A object.
/// 1
// Token: 0x06003892 RID: 14482 RVA: 0x000C3DD0 File Offset: 0x000C1FD0
public static CompressedStack Capture()
{
CompressedStack compressedStack = new CompressedStack(0);
compressedStack._list = SecurityFrame.GetStack(1);
CompressedStack compressedStack2 = Thread.CurrentThread.GetCompressedStack();
if (compressedStack2 != null)
{
for (int i = 0; i < compressedStack2._list.Count; i++)
{
compressedStack._list.Add(compressedStack2._list[i]);
}
}
return compressedStack;
}
/// Gets the compressed stack for the current thread.
/// A for the current thread.
/// A caller in the call chain does not have permission to access unmanaged code.-or-The request for failed.
/// 1
///
///
///
///
// Token: 0x06003893 RID: 14483 RVA: 0x000C3E38 File Offset: 0x000C2038
public static CompressedStack GetCompressedStack()
{
CompressedStack compressedStack = Thread.CurrentThread.GetCompressedStack();
if (compressedStack == null)
{
compressedStack = CompressedStack.Capture();
}
else
{
CompressedStack compressedStack2 = CompressedStack.Capture();
for (int i = 0; i < compressedStack2._list.Count; i++)
{
compressedStack._list.Add(compressedStack2._list[i]);
}
}
return compressedStack;
}
/// Sets the object with the logical context information needed to recreate an instance of this execution context.
/// The object to be populated with serialization information.
/// The structure representing the destination context of the serialization.
///
/// is null.
/// 1
// Token: 0x06003894 RID: 14484 RVA: 0x000C3E9C File Offset: 0x000C209C
[MonoTODO("incomplete")]
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
}
/// Runs a method in the specified compressed stack on the current thread.
/// The to set.
/// A that represents the method to be run in the specified security context.
/// The object to be passed to the callback method.
///
/// is null.
// Token: 0x06003895 RID: 14485 RVA: 0x000C3EB0 File Offset: 0x000C20B0
public static void Run(CompressedStack compressedStack, ContextCallback callback, object state)
{
if (compressedStack == null)
{
throw new ArgumentException("compressedStack");
}
Thread currentThread = Thread.CurrentThread;
CompressedStack compressedStack2 = null;
try
{
compressedStack2 = currentThread.GetCompressedStack();
currentThread.SetCompressedStack(compressedStack);
callback(state);
}
finally
{
if (compressedStack2 != null)
{
currentThread.SetCompressedStack(compressedStack2);
}
}
}
// Token: 0x06003896 RID: 14486 RVA: 0x000C3F1C File Offset: 0x000C211C
internal bool Equals(CompressedStack cs)
{
if (this.IsEmpty())
{
return cs.IsEmpty();
}
if (cs.IsEmpty())
{
return false;
}
if (this._list.Count != cs._list.Count)
{
return false;
}
for (int i = 0; i < this._list.Count; i++)
{
SecurityFrame securityFrame = (SecurityFrame)this._list[i];
SecurityFrame securityFrame2 = (SecurityFrame)cs._list[i];
if (!securityFrame.Equals(securityFrame2))
{
return false;
}
}
return true;
}
// Token: 0x06003897 RID: 14487 RVA: 0x000C3FB8 File Offset: 0x000C21B8
internal bool IsEmpty()
{
return this._list == null || this._list.Count == 0;
}
// Token: 0x17000AFE RID: 2814
// (get) Token: 0x06003898 RID: 14488 RVA: 0x000C3FD8 File Offset: 0x000C21D8
internal IList List
{
get
{
return this._list;
}
}
// Token: 0x040016E4 RID: 5860
private ArrayList _list;
}
}