scripts
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Security;
|
||||
|
||||
namespace System.Threading
|
||||
{
|
||||
/// <summary>Provides the functionality to restore the migration, or flow, of the execution context between threads. </summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x02000609 RID: 1545
|
||||
public struct AsyncFlowControl : IDisposable
|
||||
{
|
||||
// Token: 0x06003886 RID: 14470 RVA: 0x000C3C60 File Offset: 0x000C1E60
|
||||
internal AsyncFlowControl(Thread t, AsyncFlowControlType type)
|
||||
{
|
||||
this._t = t;
|
||||
this._type = type;
|
||||
}
|
||||
|
||||
/// <summary>Releases all resources used by the <see cref="T:System.Threading.AsyncFlowControl" />.</summary>
|
||||
// Token: 0x06003887 RID: 14471 RVA: 0x000C3C70 File Offset: 0x000C1E70
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
if (this._t != null)
|
||||
{
|
||||
this.Undo();
|
||||
this._t = null;
|
||||
this._type = AsyncFlowControlType.None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Restores the flow of the execution context between threads.</summary>
|
||||
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.Threading.AsyncFlowControl" /> structure is not used on the thread where it was created.-or-The <see cref="T:System.Threading.AsyncFlowControl" /> structure has already been used to call <see cref="M:System.Threading.AsyncFlowControl.Undo" />.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06003888 RID: 14472 RVA: 0x000C3C94 File Offset: 0x000C1E94
|
||||
public void Undo()
|
||||
{
|
||||
if (this._t == null)
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("Can only be called once."));
|
||||
}
|
||||
AsyncFlowControlType type = this._type;
|
||||
if (type != AsyncFlowControlType.Execution)
|
||||
{
|
||||
if (type == AsyncFlowControlType.Security)
|
||||
{
|
||||
SecurityContext.RestoreFlow();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ExecutionContext.RestoreFlow();
|
||||
}
|
||||
this._t = null;
|
||||
}
|
||||
|
||||
/// <summary>Gets a hash code for the current <see cref="T:System.Threading.AsyncFlowControl" /> structure.</summary>
|
||||
/// <returns>A hash code for the current <see cref="T:System.Threading.AsyncFlowControl" /> structure.</returns>
|
||||
// Token: 0x06003889 RID: 14473 RVA: 0x000C3CF4 File Offset: 0x000C1EF4
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the specified object is equal to the current <see cref="T:System.Threading.AsyncFlowControl" /> structure. </summary>
|
||||
/// <returns>true if <paramref name="obj" /> is an <see cref="T:System.Threading.AsyncFlowControl" /> structure and is equal to the current <see cref="T:System.Threading.AsyncFlowControl" /> structure; otherwise, false. </returns>
|
||||
/// <param name="obj">An object to compare with the current structure.</param>
|
||||
// Token: 0x0600388A RID: 14474 RVA: 0x000C3D08 File Offset: 0x000C1F08
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is AsyncFlowControl && obj.Equals(this);
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the specified <see cref="T:System.Threading.AsyncFlowControl" /> structure is equal to the current <see cref="T:System.Threading.AsyncFlowControl" /> structure.</summary>
|
||||
/// <returns>true if <paramref name="obj" /> is equal to the current <see cref="T:System.Threading.AsyncFlowControl" /> structure; otherwise, false. </returns>
|
||||
/// <param name="obj">An <see cref="T:System.Threading.AsyncFlowControl" /> structure to compare with the current structure.</param>
|
||||
// Token: 0x0600388B RID: 14475 RVA: 0x000C3D28 File Offset: 0x000C1F28
|
||||
public bool Equals(AsyncFlowControl obj)
|
||||
{
|
||||
return this._t == obj._t && this._type == obj._type;
|
||||
}
|
||||
|
||||
/// <summary>Compares two <see cref="T:System.Threading.AsyncFlowControl" /> structures to determine whether they are equal. </summary>
|
||||
/// <returns>true if the two structures are equal; otherwise, false. </returns>
|
||||
/// <param name="a">An <see cref="T:System.Threading.AsyncFlowControl" /> structure.</param>
|
||||
/// <param name="b">An <see cref="T:System.Threading.AsyncFlowControl" /> structure.</param>
|
||||
// Token: 0x0600388C RID: 14476 RVA: 0x000C3D54 File Offset: 0x000C1F54
|
||||
public static bool operator ==(AsyncFlowControl a, AsyncFlowControl b)
|
||||
{
|
||||
return a.Equals(b);
|
||||
}
|
||||
|
||||
/// <summary>Compares two <see cref="T:System.Threading.AsyncFlowControl" /> structures to determine whether they are not equal. </summary>
|
||||
/// <returns>true if the structures are not equal; otherwise, false. </returns>
|
||||
/// <param name="a">An <see cref="T:System.Threading.AsyncFlowControl" /> structure.</param>
|
||||
/// <param name="b">An <see cref="T:System.Threading.AsyncFlowControl" /> structure.</param>
|
||||
// Token: 0x0600388D RID: 14477 RVA: 0x000C3D60 File Offset: 0x000C1F60
|
||||
public static bool operator !=(AsyncFlowControl a, AsyncFlowControl b)
|
||||
{
|
||||
return !a.Equals(b);
|
||||
}
|
||||
|
||||
// Token: 0x040016E2 RID: 5858
|
||||
private Thread _t;
|
||||
|
||||
// Token: 0x040016E3 RID: 5859
|
||||
private AsyncFlowControlType _type;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user