Decompiled source of FSharpxAsync v1.13.2
core\FSharpx.Async.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using System.Threading.Tasks; using <StartupCode$FSharpx-Async>; using <StartupCode$FSharpx-Async>.$Async; using FSharp.Control; using FSharpx.Collections.Mutable; using FSharpx.Control; using FSharpx.IO; using Microsoft.FSharp.Collections; using Microsoft.FSharp.Control; using Microsoft.FSharp.Core; using Microsoft.FSharp.Core.CompilerServices; [assembly: FSharpInterfaceDataVersion(2, 0, 0)] [assembly: TargetFramework(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")] [assembly: AssemblyCompany("Tomas Petricek;David Thomas;Ryan Riley;Steffen Forkmann")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Async extensions for F#")] [assembly: AssemblyFileVersion("1.14.2.0")] [assembly: AssemblyInformationalVersion("1.14.2+b63df53c523701e74e5dea8989289a1426c05cdb")] [assembly: AssemblyProduct("FSharpx.Async")] [assembly: AssemblyTitle("FSharpx.Async")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/fsprojects/FSharpx.Async")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default)] [assembly: AssemblyVersion("1.14.2.0")] namespace FSharpx.Collections.Mutable { [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class CircularBuffer<T> : IEnumerable<T> { internal int bufferSize; internal T[] buffer; internal int head; internal int tail; internal int length; public int Count => length; public CircularBuffer(int bufferSize) { this.bufferSize = bufferSize; if (this.bufferSize <= 0) { throw new ArgumentException("The bufferSize must be greater than 0.", "bufferSize"); } buffer = ArrayModule.ZeroCreate<T>(this.bufferSize); head = this.bufferSize - 1; tail = 0; length = 0; } public T[] Dequeue(int count) { if (length == 0) { throw new InvalidOperationException("Queue exhausted."); } if (count > bufferSize) { ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException("Requested count exceeds the buffer size."); throw ex; } int num = length; int num2 = ((count >= num) ? num : count); T[] result = ArrayModule.Concat<T>((IEnumerable<T[]>)SeqModule.ToArray<T[]>((IEnumerable<T[]>)(object)new $CircularBuffer.dequeued@37<T>(this, num2, null, 0, null))); tail = (tail + num2) % bufferSize; length -= num2; return result; } public void Enqueue(T[] value, int offset, int count) { if (count > bufferSize) { throw new InvalidOperationException("Requested count is too large."); } int num = offset; head = (head + 1) % bufferSize; IEnumerable<Tuple<int, int>> enumerable = nextBuffer(head, count); int item; int item2; int sourceIndex; foreach (Tuple<int, int> item3 in enumerable) { item = item3.Item2; item2 = item3.Item1; sourceIndex = num; T[] destinationArray = buffer; Array.Copy(value, sourceIndex, destinationArray, item2, item); num += item; } if (length == bufferSize) { tail = (tail + count) % bufferSize; return; } item = length + count - bufferSize; if (item > 0) { tail = (tail + item) % bufferSize; } item2 = length + count; sourceIndex = bufferSize; length = ((item2 >= sourceIndex) ? sourceIndex : item2); } public void Enqueue(T[] value) { Enqueue(value, 0, value.Length); } public void Enqueue(T[] value, int offset) { Enqueue(value, offset, value.Length - offset); } public void Enqueue(ArraySegment<T> value) { Enqueue(value.Array, value.Offset, value.Count); } public void Enqueue(T value) { Enqueue(new T[1] { value }, 0, 1); } public IEnumerator<T> GetEnumerator() { return $CircularBuffer.loop@74(this, null).GetEnumerator(); } virtual IEnumerator<T> IEnumerable<T>.GetEnumerator() { return GetEnumerator(); } virtual IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } [CompilationArgumentCounts(new int[] { 1, 1 })] [CompilerGenerated] internal IEnumerable<Tuple<int, int>> nextBuffer(int offset, int count) { return (IEnumerable<Tuple<int, int>>)(object)new $CircularBuffer.clo@20<T>(this, offset, count, 0, 0, null); } } } namespace FSharpx.Control { [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class AutoCancelAgent<T> : IDisposable { internal FSharpMailboxProcessor<T> mbox; internal CancellationTokenSource cts; public int CurrentQueueLength => mbox.CurrentQueueLength; [CLIEvent] public event FSharpHandler<Exception> Error { add { FSharpMailboxProcessor<T> eventTarget = mbox; ((IDelegateEvent<FSharpHandler<Exception>>)(object)RuntimeHelpers.CreateEvent<FSharpHandler<Exception>, Exception>((FSharpFunc<FSharpHandler<Exception>, Unit>)new $AutoCancelAgent.add_Error@29<T>(eventTarget), (FSharpFunc<FSharpHandler<Exception>, Unit>)new $AutoCancelAgent.add_Error@29-1<T>(eventTarget), (FSharpFunc<FSharpFunc<object, FSharpFunc<Exception, Unit>>, FSharpHandler<Exception>>)$AutoCancelAgent.add_Error@29-2.@_instance)).AddHandler(value); } remove { FSharpMailboxProcessor<T> eventTarget = mbox; ((IDelegateEvent<FSharpHandler<Exception>>)(object)RuntimeHelpers.CreateEvent<FSharpHandler<Exception>, Exception>((FSharpFunc<FSharpHandler<Exception>, Unit>)new $AutoCancelAgent.remove_Error@29<T>(eventTarget), (FSharpFunc<FSharpHandler<Exception>, Unit>)new $AutoCancelAgent.remove_Error@29-1<T>(eventTarget), (FSharpFunc<FSharpFunc<object, FSharpFunc<Exception, Unit>>, FSharpHandler<Exception>>)$AutoCancelAgent.remove_Error@29-2.@_instance)).RemoveHandler(value); } } internal AutoCancelAgent(FSharpMailboxProcessor<T> mbox, CancellationTokenSource cts) { this.mbox = mbox; this.cts = cts; } public static AutoCancelAgent<T> Start(FSharpFunc<FSharpMailboxProcessor<T>, FSharpAsync<Unit>> f) { CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); return new AutoCancelAgent<T>(FSharpMailboxProcessor<T>.Start(f, FSharpOption<CancellationToken>.Some(cancellationTokenSource.Token)), cancellationTokenSource); } public FSharpAsync<T> Receive([OptionalArgument] FSharpOption<int> timeout) { return mbox.Receive(timeout); } public FSharpAsync<a> Scan<a>(FSharpFunc<T, FSharpOption<FSharpAsync<a>>> scanner, [OptionalArgument] FSharpOption<int> timeout) { return mbox.Scan<a>(scanner, timeout); } public FSharpOption<a> TryPostAndReply<a>(FSharpFunc<FSharpAsyncReplyChannel<a>, T> buildMessage, [OptionalArgument] FSharpOption<int> timeout) { return mbox.TryPostAndReply<a>(buildMessage, timeout); } public FSharpAsync<FSharpOption<T>> TryReceive([OptionalArgument] FSharpOption<int> timeout) { return mbox.TryReceive(timeout); } public FSharpAsync<FSharpOption<a>> TryScan<a>(FSharpFunc<T, FSharpOption<FSharpAsync<a>>> scanner, [OptionalArgument] FSharpOption<int> timeout) { return mbox.TryScan<a>(scanner, timeout); } public void Post(T m) { mbox.Post(m); } public a PostAndReply<a>(FSharpFunc<FSharpAsyncReplyChannel<a>, T> buildMessage, [OptionalArgument] FSharpOption<int> timeout) { return mbox.PostAndReply<a>(buildMessage, timeout); } public FSharpAsync<FSharpOption<a>> PostAndTryAsyncReply<a>(FSharpFunc<FSharpAsyncReplyChannel<a>, T> buildMessage, [OptionalArgument] FSharpOption<int> timeout) { return mbox.PostAndTryAsyncReply<a>(buildMessage, timeout); } public FSharpAsync<a> PostAndAsyncReply<a>(FSharpFunc<FSharpAsyncReplyChannel<a>, T> buildMessage, [OptionalArgument] FSharpOption<int> timeout) { return mbox.PostAndAsyncReply<a>(buildMessage, timeout); } virtual void IDisposable.Dispose() { ((IDisposable)mbox).Dispose(); cts.Cancel(); } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class BatchProcessingAgent<T> : IDisposable { internal int timeout; internal int batchSize; internal FSharpEvent<T[]> batchEvent; internal CancellationTokenSource cts; internal FSharpMailboxProcessor<T> agent; [CLIEvent] public event FSharpHandler<T[]> BatchProduced { add { ((IDelegateEvent<FSharpHandler<FSharpHandler<T[]>[]>>)(object)((FSharpEvent<T[][]>)(object)batchEvent).Publish).AddHandler((FSharpHandler<FSharpHandler<T[]>[]>)(object)value); } remove { ((IDelegateEvent<FSharpHandler<FSharpHandler<T[]>[]>>)(object)((FSharpEvent<T[][]>)(object)batchEvent).Publish).RemoveHandler((FSharpHandler<FSharpHandler<T[]>[]>)(object)value); } } public BatchProcessingAgent(int batchSize, int timeout) { this.batchSize = batchSize; this.timeout = timeout; batchEvent = (FSharpEvent<T[]>)(object)new FSharpEvent<T[][]>(); cts = new CancellationTokenSource(); agent = FSharpMailboxProcessor<T>.Start((FSharpFunc<FSharpMailboxProcessor<T>, FSharpAsync<Unit>>)new $BatchProcessingAgent.-ctor@39<T>(this), FSharpOption<CancellationToken>.Some(cts.Token)); } public void Enqueue(T v) { agent.Post(v); } virtual void IDisposable.Dispose() { cts.Cancel(); } [CompilerGenerated] internal FSharpAsync<b> body<b>(FSharpMailboxProcessor<T> agent) { return $BatchProcessingAgent.loop@23-2<T, b>(this, agent, timeout, FSharpList<T>.Empty); } } [Serializable] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [DebuggerDisplay("{__DebugDisplay(),nq}")] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal abstract class BlockingAgentMessage<T> : IEquatable<BlockingAgentMessage<T>>, IStructuralEquatable { internal static class Tags { public const int AsyncAdd = 0; public const int Add = 1; public const int AsyncGet = 2; } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(BlockingAgentMessage<>.AsyncAdd@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class AsyncAdd : BlockingAgentMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly T item1; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly FSharpAsyncReplyChannel<Unit> item2; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal T Item1 { [CompilerGenerated] [DebuggerNonUserCode] get { return item1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal FSharpAsyncReplyChannel<Unit> Item2 { [CompilerGenerated] [DebuggerNonUserCode] get { return item2; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BlockingAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal AsyncAdd(T item1, FSharpAsyncReplyChannel<Unit> item2) { this.item1 = item1; this.item2 = item2; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(BlockingAgentMessage<>.Add@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class Add : BlockingAgentMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly T item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal T Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BlockingAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal Add(T item) { this.item = item; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(BlockingAgentMessage<>.AsyncGet@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class AsyncGet : BlockingAgentMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly FSharpAsyncReplyChannel<T> item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal FSharpAsyncReplyChannel<T> Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BlockingAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal AsyncGet(FSharpAsyncReplyChannel<T> item) { this.item = item; } } [SpecialName] internal class AsyncAdd@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public T Item1 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpAsyncReplyChannel<Unit> Item2 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item2; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BlockingAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public AsyncAdd@DebugTypeProxy(AsyncAdd obj) { _obj = obj; } } [SpecialName] internal class Add@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public T Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BlockingAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public Add@DebugTypeProxy(Add obj) { _obj = obj; } } [SpecialName] internal class AsyncGet@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpAsyncReplyChannel<T> Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BlockingAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public AsyncGet@DebugTypeProxy(AsyncGet obj) { _obj = obj; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int Tag { [CompilerGenerated] [DebuggerNonUserCode] get { return (this is AsyncGet) ? 2 : ((this is Add) ? 1 : 0); } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsAsyncAdd { [CompilerGenerated] [DebuggerNonUserCode] get { return this is AsyncAdd; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsAdd { [CompilerGenerated] [DebuggerNonUserCode] get { return this is Add; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsAsyncGet { [CompilerGenerated] [DebuggerNonUserCode] get { return this is AsyncGet; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BlockingAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal BlockingAgentMessage() { } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static BlockingAgentMessage<T> NewAsyncAdd(T item1, FSharpAsyncReplyChannel<Unit> item2) { return new AsyncAdd(item1, item2); } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static BlockingAgentMessage<T> NewAdd(T item) { return new Add(item); } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static BlockingAgentMessage<T> NewAsyncGet(FSharpAsyncReplyChannel<T> item) { return new AsyncGet(item); } [SpecialName] [CompilerGenerated] [DebuggerNonUserCode] internal object __DebugDisplay() { return ((FSharpFunc<BlockingAgentMessage<BlockingAgentMessage<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<BlockingAgentMessage<T>, string>>((PrintfFormat<FSharpFunc<BlockingAgentMessage<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<BlockingAgentMessage<FSharpFunc<BlockingAgentMessage<T>, string>>, string>, Unit, string, string, string>("%+0.8A"))).Invoke((BlockingAgentMessage<BlockingAgentMessage<T>>)(object)this); } [CompilerGenerated] public override string ToString() { return ((FSharpFunc<BlockingAgentMessage<BlockingAgentMessage<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<BlockingAgentMessage<T>, string>>((PrintfFormat<FSharpFunc<BlockingAgentMessage<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<BlockingAgentMessage<FSharpFunc<BlockingAgentMessage<T>, string>>, string>, Unit, string, string, BlockingAgentMessage<FSharpFunc<BlockingAgentMessage<T>, string>>>("%+A"))).Invoke((BlockingAgentMessage<BlockingAgentMessage<T>>)(object)this); } [CompilerGenerated] public virtual sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; T item; if (!(this is AsyncAdd)) { if (this is Add) { Add add = (Add)this; num = 1; item = add.item; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<T>(comp, item) + ((num << 6) + (num >> 2))); } if (this is AsyncGet) { AsyncGet asyncGet = (AsyncGet)this; num = 2; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<FSharpAsyncReplyChannel<T>>(comp, asyncGet.item) + ((num << 6) + (num >> 2))); } } AsyncAdd asyncAdd = (AsyncAdd)this; num = 0; num = -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<FSharpAsyncReplyChannel<Unit>>(comp, asyncAdd.item2) + ((num << 6) + (num >> 2))); item = asyncAdd.item1; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<T>(comp, item) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public virtual sealed bool Equals(object obj, IEqualityComparer comp) { if (this != null) { if (obj is BlockingAgentMessage<T> blockingAgentMessage) { int num = ((this is AsyncGet) ? 2 : ((this is Add) ? 1 : 0)); BlockingAgentMessage<T> blockingAgentMessage2 = blockingAgentMessage; int num2 = ((blockingAgentMessage2 is AsyncGet) ? 2 : ((blockingAgentMessage2 is Add) ? 1 : 0)); if (num == num2) { T item; T item2; if (!(this is AsyncAdd)) { if (this is Add) { Add add = (Add)this; Add add2 = (Add)blockingAgentMessage; item = add.item; item2 = add2.item; return HashCompare.GenericEqualityWithComparerIntrinsic<T>(comp, item, item2); } if (this is AsyncGet) { AsyncGet asyncGet = (AsyncGet)this; AsyncGet asyncGet2 = (AsyncGet)blockingAgentMessage; return HashCompare.GenericEqualityWithComparerIntrinsic<FSharpAsyncReplyChannel<T>>(comp, asyncGet.item, asyncGet2.item); } } AsyncAdd asyncAdd = (AsyncAdd)this; AsyncAdd asyncAdd2 = (AsyncAdd)blockingAgentMessage; item = asyncAdd.item1; item2 = asyncAdd2.item1; if (HashCompare.GenericEqualityWithComparerIntrinsic<T>(comp, item, item2)) { return HashCompare.GenericEqualityWithComparerIntrinsic<FSharpAsyncReplyChannel<Unit>>(comp, asyncAdd.item2, asyncAdd2.item2); } return false; } return false; } return false; } return obj == null; } [CompilerGenerated] public virtual sealed bool Equals(BlockingAgentMessage<T> obj) { if (this != null) { if (obj != null) { int num = ((this is AsyncGet) ? 2 : ((this is Add) ? 1 : 0)); int num2 = ((obj is AsyncGet) ? 2 : ((obj is Add) ? 1 : 0)); if (num == num2) { T item; T item2; if (!(this is AsyncAdd)) { if (this is Add) { Add add = (Add)this; Add add2 = (Add)obj; item = add.item; item2 = add2.item; return HashCompare.GenericEqualityERIntrinsic<T>(item, item2); } if (this is AsyncGet) { AsyncGet asyncGet = (AsyncGet)this; AsyncGet asyncGet2 = (AsyncGet)obj; return HashCompare.GenericEqualityERIntrinsic<FSharpAsyncReplyChannel<T>>(asyncGet.item, asyncGet2.item); } } AsyncAdd asyncAdd = (AsyncAdd)this; AsyncAdd asyncAdd2 = (AsyncAdd)obj; item = asyncAdd.item1; item2 = asyncAdd2.item1; if (HashCompare.GenericEqualityERIntrinsic<T>(item, item2)) { return HashCompare.GenericEqualityERIntrinsic<FSharpAsyncReplyChannel<Unit>>(asyncAdd.item2, asyncAdd2.item2); } return false; } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is BlockingAgentMessage<T> obj2) { return Equals(obj2); } return false; } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class BlockingQueueAgent<T> : IDisposable { [VolatileField] internal int count; internal FSharpMailboxProcessor<BlockingAgentMessage<T>> agent; public int Count => count; public BlockingQueueAgent(int maxLength) { count = 0; agent = FSharpMailboxProcessor<BlockingAgentMessage<BlockingAgentMessage<T>>>.Start((FSharpFunc<FSharpMailboxProcessor<BlockingAgentMessage<BlockingAgentMessage<T>>>, FSharpAsync<Unit>>)(object)new $BlockingQueueAgent.-ctor@26-1<T>(this, maxLength), (FSharpOption<CancellationToken>)null); } public FSharpAsync<Unit> AsyncAdd(T v, [OptionalArgument] FSharpOption<int> timeout) { return ((FSharpMailboxProcessor<BlockingAgentMessage<BlockingAgentMessage<T>>>)(object)agent).PostAndAsyncReply<Unit>((FSharpFunc<FSharpAsyncReplyChannel<Unit>, BlockingAgentMessage<BlockingAgentMessage<T>>>)(object)new $BlockingQueueAgent.AsyncAdd@78<T>(v), timeout); } public void Add(T v) { ((FSharpMailboxProcessor<BlockingAgentMessage<BlockingAgentMessage<T>>>)(object)agent).Post((BlockingAgentMessage<BlockingAgentMessage<T>>)(object)BlockingAgentMessage<T>.NewAdd(v)); } public FSharpAsync<T> AsyncGet([OptionalArgument] FSharpOption<int> timeout) { return ((FSharpMailboxProcessor<BlockingAgentMessage<BlockingAgentMessage<T>>>)(object)agent).PostAndAsyncReply<T>((FSharpFunc<FSharpAsyncReplyChannel<T>, BlockingAgentMessage<BlockingAgentMessage<T>>>)(object)$BlockingQueueAgent.AsyncGet@90<T>.@_instance, timeout); } public T Get([OptionalArgument] FSharpOption<int> timeout) { return ((FSharpMailboxProcessor<BlockingAgentMessage<BlockingAgentMessage<T>>>)(object)agent).PostAndReply<T>((FSharpFunc<FSharpAsyncReplyChannel<T>, BlockingAgentMessage<BlockingAgentMessage<T>>>)(object)$BlockingQueueAgent.Get@96<T>.@_instance, timeout); } virtual void IDisposable.Dispose() { ((IDisposable)agent).Dispose(); } } [Serializable] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [DebuggerDisplay("{__DebugDisplay(),nq}")] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal abstract class CircularQueueMessage<T> : IEquatable<CircularQueueMessage<T>>, IStructuralEquatable { internal static class Tags { public const int AsyncEnqueue = 0; public const int Enqueue = 1; public const int AsyncDequeue = 2; } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(CircularQueueMessage<>.AsyncEnqueue@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class AsyncEnqueue : CircularQueueMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly T[] item1; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly int item2; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly int item3; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly FSharpAsyncReplyChannel<Unit> item4; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal T[] Item1 { [CompilerGenerated] [DebuggerNonUserCode] get { return item1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal int Item2 { [CompilerGenerated] [DebuggerNonUserCode] get { return item2; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal int Item3 { [CompilerGenerated] [DebuggerNonUserCode] get { return item3; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal FSharpAsyncReplyChannel<Unit> Item4 { [CompilerGenerated] [DebuggerNonUserCode] get { return item4; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(CircularQueueMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal AsyncEnqueue(T[] item1, int item2, int item3, FSharpAsyncReplyChannel<Unit> item4) { this.item1 = item1; this.item2 = item2; this.item3 = item3; this.item4 = item4; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(CircularQueueMessage<>.Enqueue@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class Enqueue : CircularQueueMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly T[] item1; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly int item2; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly int item3; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal T[] Item1 { [CompilerGenerated] [DebuggerNonUserCode] get { return item1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal int Item2 { [CompilerGenerated] [DebuggerNonUserCode] get { return item2; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal int Item3 { [CompilerGenerated] [DebuggerNonUserCode] get { return item3; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(CircularQueueMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal Enqueue(T[] item1, int item2, int item3) { this.item1 = item1; this.item2 = item2; this.item3 = item3; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(CircularQueueMessage<>.AsyncDequeue@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class AsyncDequeue : CircularQueueMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly int item1; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly FSharpAsyncReplyChannel<T[]> item2; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal int Item1 { [CompilerGenerated] [DebuggerNonUserCode] get { return item1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal FSharpAsyncReplyChannel<T[]> Item2 { [CompilerGenerated] [DebuggerNonUserCode] get { return item2; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(CircularQueueMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal AsyncDequeue(int item1, FSharpAsyncReplyChannel<T[]> item2) { this.item1 = item1; this.item2 = item2; } } [SpecialName] internal class AsyncEnqueue@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public T[] Item1 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public int Item2 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item2; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public int Item3 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item3; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpAsyncReplyChannel<Unit> Item4 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item4; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(CircularQueueMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public AsyncEnqueue@DebugTypeProxy(AsyncEnqueue obj) { _obj = obj; } } [SpecialName] internal class Enqueue@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public T[] Item1 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public int Item2 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item2; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public int Item3 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item3; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(CircularQueueMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public Enqueue@DebugTypeProxy(Enqueue obj) { _obj = obj; } } [SpecialName] internal class AsyncDequeue@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public int Item1 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpAsyncReplyChannel<T[]> Item2 { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item2; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(CircularQueueMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public AsyncDequeue@DebugTypeProxy(AsyncDequeue obj) { _obj = obj; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int Tag { [CompilerGenerated] [DebuggerNonUserCode] get { return (this is AsyncDequeue) ? 2 : ((this is Enqueue) ? 1 : 0); } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsAsyncEnqueue { [CompilerGenerated] [DebuggerNonUserCode] get { return this is AsyncEnqueue; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsEnqueue { [CompilerGenerated] [DebuggerNonUserCode] get { return this is Enqueue; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsAsyncDequeue { [CompilerGenerated] [DebuggerNonUserCode] get { return this is AsyncDequeue; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(CircularQueueMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal CircularQueueMessage() { } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static CircularQueueMessage<T> NewAsyncEnqueue(T[] item1, int item2, int item3, FSharpAsyncReplyChannel<Unit> item4) { return new AsyncEnqueue(item1, item2, item3, item4); } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static CircularQueueMessage<T> NewEnqueue(T[] item1, int item2, int item3) { return new Enqueue(item1, item2, item3); } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static CircularQueueMessage<T> NewAsyncDequeue(int item1, FSharpAsyncReplyChannel<T[]> item2) { return new AsyncDequeue(item1, item2); } [SpecialName] [CompilerGenerated] [DebuggerNonUserCode] internal object __DebugDisplay() { return ((FSharpFunc<CircularQueueMessage<CircularQueueMessage<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<CircularQueueMessage<T>, string>>((PrintfFormat<FSharpFunc<CircularQueueMessage<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<CircularQueueMessage<FSharpFunc<CircularQueueMessage<T>, string>>, string>, Unit, string, string, string>("%+0.8A"))).Invoke((CircularQueueMessage<CircularQueueMessage<T>>)(object)this); } [CompilerGenerated] public override string ToString() { return ((FSharpFunc<CircularQueueMessage<CircularQueueMessage<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<CircularQueueMessage<T>, string>>((PrintfFormat<FSharpFunc<CircularQueueMessage<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<CircularQueueMessage<FSharpFunc<CircularQueueMessage<T>, string>>, string>, Unit, string, string, CircularQueueMessage<FSharpFunc<CircularQueueMessage<T>, string>>>("%+A"))).Invoke((CircularQueueMessage<CircularQueueMessage<T>>)(object)this); } [CompilerGenerated] public virtual sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { return $CircularQueueAgent.GetHashCode$cont@13(comp, this, null); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public virtual sealed bool Equals(object obj, IEqualityComparer comp) { if (this != null) { if (obj is CircularQueueMessage<T> circularQueueMessage) { int num = ((this is AsyncDequeue) ? 2 : ((this is Enqueue) ? 1 : 0)); CircularQueueMessage<T> circularQueueMessage2 = circularQueueMessage; int num2 = ((circularQueueMessage2 is AsyncDequeue) ? 2 : ((circularQueueMessage2 is Enqueue) ? 1 : 0)); if (num == num2) { return $CircularQueueAgent.Equals$cont@13(this, circularQueueMessage, comp, null); } return false; } return false; } return obj == null; } [CompilerGenerated] public virtual sealed bool Equals(CircularQueueMessage<T> obj) { if (this != null) { if (obj != null) { int num = ((this is AsyncDequeue) ? 2 : ((this is Enqueue) ? 1 : 0)); int num2 = ((obj is AsyncDequeue) ? 2 : ((obj is Enqueue) ? 1 : 0)); if (num == num2) { return $CircularQueueAgent.Equals$cont@13-1(this, obj, null); } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is CircularQueueMessage<T> obj2) { return Equals(obj2); } return false; } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class CircularQueueAgent<T> { [VolatileField] internal int count; internal FSharpMailboxProcessor<CircularQueueMessage<T>> agent; public int Count => count; public CircularQueueAgent(int maxLength) { count = 0; agent = FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>.Start((FSharpFunc<FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>, FSharpAsync<Unit>>)(object)new $CircularQueueAgent.-ctor@26-2<T>(this, maxLength), (FSharpOption<CancellationToken>)null); } public FSharpAsync<Unit> AsyncEnqueue(T[] value, int offset, int count, [OptionalArgument] FSharpOption<int> timeout) { return ((FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>)(object)agent).PostAndAsyncReply<Unit>((FSharpFunc<FSharpAsyncReplyChannel<Unit>, CircularQueueMessage<CircularQueueMessage<T>>>)(object)new $CircularQueueAgent.AsyncEnqueue@80<T>(value, offset, count), timeout); } public FSharpAsync<Unit> AsyncEnqueue(ArraySegment<T> segment, [OptionalArgument] FSharpOption<int> timeout) { return ((FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>)(object)agent).PostAndAsyncReply<Unit>((FSharpFunc<FSharpAsyncReplyChannel<Unit>, CircularQueueMessage<CircularQueueMessage<T>>>)(object)new $CircularQueueAgent.AsyncEnqueue@86-1<T>(segment), timeout); } public FSharpAsync<Unit> AsyncEnqueue(T[] value, [OptionalArgument] FSharpOption<int> timeout) { return ((FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>)(object)agent).PostAndAsyncReply<Unit>((FSharpFunc<FSharpAsyncReplyChannel<Unit>, CircularQueueMessage<CircularQueueMessage<T>>>)(object)new $CircularQueueAgent.AsyncEnqueue@92-2<T>(value), timeout); } public void Enqueue(T[] value, int offset, int count) { ((FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>)(object)agent).Post((CircularQueueMessage<CircularQueueMessage<T>>)(object)CircularQueueMessage<T>.NewEnqueue(value, offset, count)); } public void Enqueue(ArraySegment<T> segment) { ((FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>)(object)agent).Post((CircularQueueMessage<CircularQueueMessage<T>>)(object)CircularQueueMessage<T>.NewEnqueue(segment.Array, segment.Offset, segment.Count)); } public void Enqueue(T[] value) { ((FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>)(object)agent).Post((CircularQueueMessage<CircularQueueMessage<T>>)(object)CircularQueueMessage<T>.NewEnqueue(value, 0, value.Length)); } public FSharpAsync<T[]> AsyncDequeue(int count, [OptionalArgument] FSharpOption<int> timeout) { return ((FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>)(object)agent).PostAndAsyncReply<T[]>((FSharpFunc<FSharpAsyncReplyChannel<T[]>, CircularQueueMessage<CircularQueueMessage<T>>>)(object)new $CircularQueueAgent.AsyncDequeue@115<T>(count), timeout); } public T[] Dequeue(int count, [OptionalArgument] FSharpOption<int> timeout) { return ((FSharpMailboxProcessor<CircularQueueMessage<CircularQueueMessage<T>>>)(object)agent).PostAndReply<T[]>((FSharpFunc<FSharpAsyncReplyChannel<T[]>, CircularQueueMessage<CircularQueueMessage<T>>>)(object)new $CircularQueueAgent.Dequeue@121<T>(count), timeout); } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class ConcurrentSetAgent<T> { internal FSharpMailboxProcessor<Tuple<object, FSharpAsyncReplyChannel<bool>>> agent; public ConcurrentSetAgent() { agent = FSharpMailboxProcessor<Tuple<object, FSharpAsyncReplyChannel<bool>>>.Start((FSharpFunc<FSharpMailboxProcessor<Tuple<object, FSharpAsyncReplyChannel<bool>>>, FSharpAsync<Unit>>)$ConcurrentSetAgent.-ctor@16-3.@_instance, (FSharpOption<CancellationToken>)null); } public FSharpAsync<bool> AsyncAdd(object v) { return agent.PostAndAsyncReply<bool>((FSharpFunc<FSharpAsyncReplyChannel<bool>, Tuple<object, FSharpAsyncReplyChannel<bool>>>)new $ConcurrentSetAgent.AsyncAdd@25-1(v), (FSharpOption<int>)null); } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class SlidingWindowAgent<T> { internal FSharpEvent<T[]> windowEvent; internal FSharpMailboxProcessor<T> agent; [CLIEvent] public event FSharpHandler<T[]> WindowProduced { add { ((IDelegateEvent<FSharpHandler<FSharpHandler<T[]>[]>>)(object)((FSharpEvent<T[][]>)(object)windowEvent).Publish).AddHandler((FSharpHandler<FSharpHandler<T[]>[]>)(object)value); } remove { ((IDelegateEvent<FSharpHandler<FSharpHandler<T[]>[]>>)(object)((FSharpEvent<T[][]>)(object)windowEvent).Publish).RemoveHandler((FSharpHandler<FSharpHandler<T[]>[]>)(object)value); } } public SlidingWindowAgent(int windowSize, [OptionalArgument] FSharpOption<CancellationToken> cancelToken) { windowEvent = (FSharpEvent<T[]>)(object)new FSharpEvent<T[][]>(); agent = FSharpMailboxProcessor<T>.Start((FSharpFunc<FSharpMailboxProcessor<T>, FSharpAsync<Unit>>)new $SlidingWindowAgent.-ctor@22-9<T>(this, windowSize), cancelToken); } public void Enqueue(T v) { agent.Post(v); } } [Serializable] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [DebuggerDisplay("{__DebugDisplay(),nq}")] [CompilationMapping(/*Could not decode attribute arguments.*/)] public abstract class ObservableUpdate<T> : IEquatable<ObservableUpdate<T>>, IStructuralEquatable { public static class Tags { public const int Next = 0; public const int Error = 1; public const int Completed = 2; } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(ObservableUpdate<>.Next@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] public class Next : ObservableUpdate<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly T item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public T Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ObservableUpdate<>))] [CompilerGenerated] [DebuggerNonUserCode] internal Next(T item) { this.item = item; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(ObservableUpdate<>.Error@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] public class Error : ObservableUpdate<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly Exception item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public Exception Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ObservableUpdate<>))] [CompilerGenerated] [DebuggerNonUserCode] internal Error(Exception item) { this.item = item; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(ObservableUpdate<>._Completed@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class _Completed : ObservableUpdate<T> { [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ObservableUpdate<>))] [CompilerGenerated] [DebuggerNonUserCode] internal _Completed() { } } [SpecialName] internal class Next@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public T Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ObservableUpdate<>))] [CompilerGenerated] [DebuggerNonUserCode] public Next@DebugTypeProxy(Next obj) { _obj = obj; } } [SpecialName] internal class Error@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public Exception Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ObservableUpdate<>))] [CompilerGenerated] [DebuggerNonUserCode] public Error@DebugTypeProxy(Error obj) { _obj = obj; } } [SpecialName] internal class _Completed@DebugTypeProxy { [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ObservableUpdate<>))] [CompilerGenerated] [DebuggerNonUserCode] public _Completed@DebugTypeProxy(_Completed obj) { _obj = obj; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public int Tag { [CompilerGenerated] [DebuggerNonUserCode] get { return (this is _Completed) ? 2 : ((this is Error) ? 1 : 0); } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsNext { [CompilerGenerated] [DebuggerNonUserCode] get { return this is Next; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsError { [CompilerGenerated] [DebuggerNonUserCode] get { return this is Error; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public static ObservableUpdate<T> Completed { [CompilationMapping(/*Could not decode attribute arguments.*/)] get { return _unique_Completed; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsCompleted { [CompilerGenerated] [DebuggerNonUserCode] get { return this is _Completed; } } static ObservableUpdate() { _unique_Completed = new _Completed(); } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(ObservableUpdate<>))] [CompilerGenerated] [DebuggerNonUserCode] internal ObservableUpdate() { } [CompilationMapping(/*Could not decode attribute arguments.*/)] public static ObservableUpdate<T> NewNext(T item) { return new Next(item); } [CompilationMapping(/*Could not decode attribute arguments.*/)] public static ObservableUpdate<T> NewError(Exception item) { return new Error(item); } [SpecialName] [CompilerGenerated] [DebuggerNonUserCode] internal object __DebugDisplay() { return ((FSharpFunc<ObservableUpdate<ObservableUpdate<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<ObservableUpdate<T>, string>>((PrintfFormat<FSharpFunc<ObservableUpdate<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<ObservableUpdate<FSharpFunc<ObservableUpdate<T>, string>>, string>, Unit, string, string, string>("%+0.8A"))).Invoke((ObservableUpdate<ObservableUpdate<T>>)(object)this); } [CompilerGenerated] public override string ToString() { return ((FSharpFunc<ObservableUpdate<ObservableUpdate<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<ObservableUpdate<T>, string>>((PrintfFormat<FSharpFunc<ObservableUpdate<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<ObservableUpdate<FSharpFunc<ObservableUpdate<T>, string>>, string>, Unit, string, string, ObservableUpdate<FSharpFunc<ObservableUpdate<T>, string>>>("%+A"))).Invoke((ObservableUpdate<ObservableUpdate<T>>)(object)this); } [CompilerGenerated] public virtual sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; if (!(this is Next)) { if (this is Error) { Error error = (Error)this; num = 1; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<Exception>(comp, error.item) + ((num << 6) + (num >> 2))); } return (this is _Completed) ? 2 : ((this is Error) ? 1 : 0); } Next next = (Next)this; num = 0; T item = next.item; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<T>(comp, item) + ((num << 6) + (num >> 2))); } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public virtual sealed bool Equals(object obj, IEqualityComparer comp) { if (this != null) { if (obj is ObservableUpdate<T> observableUpdate) { int num = ((this is _Completed) ? 2 : ((this is Error) ? 1 : 0)); ObservableUpdate<T> observableUpdate2 = observableUpdate; int num2 = ((observableUpdate2 is _Completed) ? 2 : ((observableUpdate2 is Error) ? 1 : 0)); if (num == num2) { if (!(this is Next)) { if (this is Error) { Error error = (Error)this; Error error2 = (Error)observableUpdate; return HashCompare.GenericEqualityWithComparerIntrinsic<Exception>(comp, error.item, error2.item); } return true; } Next next = (Next)this; Next next2 = (Next)observableUpdate; T item = next.item; T item2 = next2.item; return HashCompare.GenericEqualityWithComparerIntrinsic<T>(comp, item, item2); } return false; } return false; } return obj == null; } [CompilerGenerated] public virtual sealed bool Equals(ObservableUpdate<T> obj) { if (this != null) { if (obj != null) { int num = ((this is _Completed) ? 2 : ((this is Error) ? 1 : 0)); int num2 = ((obj is _Completed) ? 2 : ((obj is Error) ? 1 : 0)); if (num == num2) { if (!(this is Next)) { if (this is Error) { Error error = (Error)this; Error error2 = (Error)obj; return HashCompare.GenericEqualityERIntrinsic<Exception>(error.item, error2.item); } return true; } Next next = (Next)this; Next next2 = (Next)obj; T item = next.item; T item2 = next2.item; return HashCompare.GenericEqualityERIntrinsic<T>(item, item2); } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is ObservableUpdate<T> obj2) { return Equals(obj2); } return false; } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class ObservableExtensions { internal ObservableExtensions() { } public static IObservable<TItem> ToObservable<TItem>(this IEnumerable<TItem> source) { return Observable.ofSeq(source); } public static IDisposable Subscribe<TSource>(this IObservable<TSource> source, Action<TSource> action) { return CommonExtensions.SubscribeToObservable<TSource>(source, (FSharpFunc<TSource, Unit>)new $Observable.Subscribe@388<TSource>(action)); } public static IObservable<TSource> Where<TSource>(this IObservable<TSource> source, Func<TSource, bool> predicate) { return ObservableModule.Filter<TSource>((FSharpFunc<TSource, bool>)new $Observable.Where@392<TSource>(predicate), source); } public static IObservable<TResult> Select<TSource, TResult>(this IObservable<TSource> source, Func<TSource, TResult> selector) { return ObservableModule.Map<TSource, TResult>((FSharpFunc<TSource, TResult>)new $Observable.Select@396<TSource, TResult>(selector), source); } public static IObservable<TResult> Select<TSource, TResult>(this IObservable<TSource> source, Func<TSource, int, TResult> selector) { return Observable.mapi<TSource, TResult>((FSharpFunc<int, FSharpFunc<TSource, TResult>>)(object)new $Observable.Select@400-1<TSource, TResult>(selector), source); } public static IObservable<TResult> SelectMany<TSource, TCollection, TResult>(this IObservable<TSource> source, Func<TSource, IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector) { return new $Observable.SelectMany@407<TSource, TCollection, TResult>(source, collectionSelector, resultSelector); } public static IObservable<TSource> TakeWhile<TSource>(this IObservable<TSource> source, Func<TSource, bool> f) { return Observable.takeWhile(new $Observable.TakeWhile@421<TSource>(f), source); } public static IObservable<TSource> Merge<TSource>(this IObservable<TSource> source, IEnumerable<IObservable<TSource>> sources) { object @_instance; @_instance = $Observable.merge@426-1.@_instance; FSharpList<IObservable<TSource>> val = SeqModule.ToList<IObservable<TSource>>(sources); return (($Observable.merge@426-1)@_instance).DirectInvoke<TSource, IObservable<TSource>>().Invoke(source).Invoke(val); } public static IObservable<TSource> Merge<TSource>(this IObservable<TSource> source, params IObservable<TSource>[] sources) { return Merge(source, SeqModule.OfArray<IObservable<TSource>>(sources)); } public static IObservable<TAccumulate> Scan<TSource, TAccumulate>(this IObservable<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> f) { return ObservableModule.Scan<TAccumulate, TSource>((FSharpFunc<TAccumulate, FSharpFunc<TSource, TAccumulate>>)(object)new $Observable.Scan@439<TSource, TAccumulate>(f), seed, source); } public static IObservable<TResult> CombineLatest<TLeft, TRight, TResult>(this IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, TRight, TResult> selector) { return ObservableModule.Map<Tuple<TLeft, TRight>, TResult>((FSharpFunc<Tuple<TLeft, TRight>, TResult>)new $Observable.CombineLatest@444<TLeft, TRight, TResult>(selector), Observable.combineLatest(left, right)); } public static IObservable<TResult> Zip<TLeft, TRight, TResult>(this IObservable<TLeft> left, IObservable<TRight> right, Func<TLeft, TRight, TResult> selector) { return ObservableModule.Map<Tuple<TLeft, TRight>, TResult>((FSharpFunc<Tuple<TLeft, TRight>, TResult>)new $Observable.Zip@449<TLeft, TRight, TResult>(selector), Observable.zip(left, right)); } public static IObservable<TSource> Delay<TSource>(this IObservable<TSource> source, int milliseconds) { return Observable.delay(milliseconds, source); } public static IObservable<IEnumerable<TSource>> BufferWithTimeOrCount<TSource>(this IObservable<TSource> source, TimeSpan timeSpan, int count) { return Observable.bufferWithTimeOrCount(timeSpan, count, source); } public static IObservable<TSource> Throttle<TSource>(this IObservable<TSource> source, TimeSpan dueTime) { return Observable.throttle((int)dueTime.TotalMilliseconds, source); } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal class CircularBuffer<T> { internal int bufferSize; internal T[] buffer; internal int index; internal int total; public CircularBuffer(int bufferSize) { this.bufferSize = bufferSize; buffer = ArrayModule.ZeroCreate<T>(this.bufferSize); index = 0; total = 0; } internal void Add(T value) { if (bufferSize > 0) { buffer[index] = value; index = (index + 1) % bufferSize; int num = total + 1; int num2 = bufferSize; total = ((num >= num2) ? num2 : num); } } internal void Iter(FSharpFunc<T, Unit> f) { int num = ((total == bufferSize) ? index : 0); int num2 = 0; int num3 = total - 1; if (num3 >= num2) { do { f.Invoke(buffer[(num + num2) % bufferSize]); num2++; } while (num2 != num3 + 1); } } } [Serializable] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [DebuggerDisplay("{__DebugDisplay(),nq}")] [CompilationMapping(/*Could not decode attribute arguments.*/)] internal class BufferAgentMessage<T> : IEquatable<BufferAgentMessage<T>>, IStructuralEquatable { internal static class Tags { public const int Add = 0; public const int Remove = 1; public const int Next = 2; public const int Completed = 3; public const int Error = 4; } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(BufferAgentMessage<>.Add@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class Add : BufferAgentMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly IObserver<T> item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal IObserver<T> Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BufferAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal Add(IObserver<T> item) : base(0) { this.item = item; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(BufferAgentMessage<>.Remove@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class Remove : BufferAgentMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly IObserver<T> item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal IObserver<T> Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BufferAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal Remove(IObserver<T> item) : base(1) { this.item = item; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(BufferAgentMessage<>.Next@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class Next : BufferAgentMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly T item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal T Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BufferAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal Next(T item) : base(2) { this.item = item; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(BufferAgentMessage<>.Error@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] internal class Error : BufferAgentMessage<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly Exception item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] internal Exception Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BufferAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal Error(Exception item) : base(4) { this.item = item; } } [SpecialName] internal class Add@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public IObserver<T> Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BufferAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public Add@DebugTypeProxy(Add obj) { _obj = obj; } } [SpecialName] internal class Remove@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public IObserver<T> Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BufferAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public Remove@DebugTypeProxy(Remove obj) { _obj = obj; } } [SpecialName] internal class Next@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public T Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BufferAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public Next@DebugTypeProxy(Next obj) { _obj = obj; } } [SpecialName] internal class Error@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public Exception Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BufferAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] public Error@DebugTypeProxy(Error obj) { _obj = obj; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal int Tag { [DebuggerNonUserCode] get; } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsAdd { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 0; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsRemove { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 1; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsNext { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 2; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal static BufferAgentMessage<T> Completed { [CompilationMapping(/*Could not decode attribute arguments.*/)] get { return _unique_Completed; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsCompleted { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 3; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] internal bool IsError { [CompilerGenerated] [DebuggerNonUserCode] get { return Tag == 4; } } static BufferAgentMessage() { _unique_Completed = new BufferAgentMessage<T>(3); } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(BufferAgentMessage<>))] [CompilerGenerated] [DebuggerNonUserCode] internal BufferAgentMessage(int _tag) { this._tag = _tag; } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static BufferAgentMessage<T> NewAdd(IObserver<T> item) { return new Add(item); } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static BufferAgentMessage<T> NewRemove(IObserver<T> item) { return new Remove(item); } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static BufferAgentMessage<T> NewNext(T item) { return new Next(item); } [CompilationMapping(/*Could not decode attribute arguments.*/)] internal static BufferAgentMessage<T> NewError(Exception item) { return new Error(item); } [SpecialName] [CompilerGenerated] [DebuggerNonUserCode] internal object __DebugDisplay() { return ((FSharpFunc<BufferAgentMessage<BufferAgentMessage<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<BufferAgentMessage<T>, string>>((PrintfFormat<FSharpFunc<BufferAgentMessage<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<BufferAgentMessage<FSharpFunc<BufferAgentMessage<T>, string>>, string>, Unit, string, string, string>("%+0.8A"))).Invoke((BufferAgentMessage<BufferAgentMessage<T>>)(object)this); } [CompilerGenerated] public override string ToString() { return ((FSharpFunc<BufferAgentMessage<BufferAgentMessage<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<BufferAgentMessage<T>, string>>((PrintfFormat<FSharpFunc<BufferAgentMessage<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<BufferAgentMessage<FSharpFunc<BufferAgentMessage<T>, string>>, string>, Unit, string, string, BufferAgentMessage<FSharpFunc<BufferAgentMessage<T>, string>>>("%+A"))).Invoke((BufferAgentMessage<BufferAgentMessage<T>>)(object)this); } [CompilerGenerated] public virtual sealed int GetHashCode(IEqualityComparer comp) { if (this != null) { int num = 0; switch (Tag) { case 0: { Add add = (Add)this; num = 0; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<IObserver<T>>(comp, add.item) + ((num << 6) + (num >> 2))); } case 1: { Remove remove = (Remove)this; num = 1; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<IObserver<T>>(comp, remove.item) + ((num << 6) + (num >> 2))); } case 2: { Next next = (Next)this; num = 2; T item = next.item; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<T>(comp, item) + ((num << 6) + (num >> 2))); } case 4: { Error error = (Error)this; num = 4; return -1640531527 + (HashCompare.GenericHashWithComparerIntrinsic<Exception>(comp, error.item) + ((num << 6) + (num >> 2))); } default: return _tag; } } return 0; } [CompilerGenerated] public sealed override int GetHashCode() { return GetHashCode(LanguagePrimitives.GenericEqualityComparer); } [CompilerGenerated] public virtual sealed bool Equals(object obj, IEqualityComparer comp) { if (this != null) { if (obj is BufferAgentMessage<T> bufferAgentMessage) { int tag = _tag; int tag2 = bufferAgentMessage._tag; if (tag == tag2) { switch (Tag) { case 0: { Add add = (Add)this; Add add2 = (Add)bufferAgentMessage; return HashCompare.GenericEqualityWithComparerIntrinsic<IObserver<T>>(comp, add.item, add2.item); } case 1: { Remove remove = (Remove)this; Remove remove2 = (Remove)bufferAgentMessage; return HashCompare.GenericEqualityWithComparerIntrinsic<IObserver<T>>(comp, remove.item, remove2.item); } case 2: { Next next = (Next)this; Next next2 = (Next)bufferAgentMessage; T item = next.item; T item2 = next2.item; return HashCompare.GenericEqualityWithComparerIntrinsic<T>(comp, item, item2); } case 4: { Error error = (Error)this; Error error2 = (Error)bufferAgentMessage; return HashCompare.GenericEqualityWithComparerIntrinsic<Exception>(comp, error.item, error2.item); } default: return true; } } return false; } return false; } return obj == null; } [CompilerGenerated] public virtual sealed bool Equals(BufferAgentMessage<T> obj) { if (this != null) { if (obj != null) { int tag = _tag; int tag2 = obj._tag; if (tag == tag2) { switch (Tag) { case 0: { Add add = (Add)this; Add add2 = (Add)obj; return HashCompare.GenericEqualityERIntrinsic<IObserver<T>>(add.item, add2.item); } case 1: { Remove remove = (Remove)this; Remove remove2 = (Remove)obj; return HashCompare.GenericEqualityERIntrinsic<IObserver<T>>(remove.item, remove2.item); } case 2: { Next next = (Next)this; Next next2 = (Next)obj; T item = next.item; T item2 = next2.item; return HashCompare.GenericEqualityERIntrinsic<T>(item, item2); } case 4: { Error error = (Error)this; Error error2 = (Error)obj; return HashCompare.GenericEqualityERIntrinsic<Exception>(error.item, error2.item); } default: return true; } } return false; } return false; } return obj == null; } [CompilerGenerated] public sealed override bool Equals(object obj) { if (obj is BufferAgentMessage<T> obj2) { return Equals(obj2); } return false; } } [Serializable] [Interface] [CompilationMapping(/*Could not decode attribute arguments.*/)] public interface ISubject<TIn, TOut> : IObservable<TOut>, IObserver<TIn> { } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class ReplaySubject<T> : ISubject<T, T> { internal FSharpMailboxProcessor<BufferAgentMessage<T>> agent; public ReplaySubject(int bufferSize) { agent = BufferAgent.start<T>((0 < bufferSize) ? bufferSize : 0); } public void OnNext(T value) { ((FSharpMailboxProcessor<BufferAgentMessage<BufferAgentMessage<T>>>)(object)agent).Post((BufferAgentMessage<BufferAgentMessage<T>>)(object)BufferAgentMessage<T>.NewNext(value)); } public void OnError(Exception error) { ((FSharpMailboxProcessor<BufferAgentMessage<BufferAgentMessage<T>>>)(object)agent).Post((BufferAgentMessage<BufferAgentMessage<T>>)(object)BufferAgentMessage<T>.NewError(error)); } public void OnCompleted() { ((FSharpMailboxProcessor<BufferAgentMessage<BufferAgentMessage<T>>>)(object)agent).Post((BufferAgentMessage<BufferAgentMessage<T>>)(object)BufferAgentMessage<T>.Completed); } public IDisposable Subscribe(IObserver<T> observer) { return subscribe(observer); } virtual void IObserver<T>.OnNext(T value) { ((FSharpMailboxProcessor<BufferAgentMessage<BufferAgentMessage<T>>>)(object)agent).Post((BufferAgentMessage<BufferAgentMessage<T>>)(object)BufferAgentMessage<T>.NewNext(value)); } virtual void IObserver<T>.OnError(Exception error) { ((FSharpMailboxProcessor<BufferAgentMessage<BufferAgentMessage<T>>>)(object)agent).Post((BufferAgentMessage<BufferAgentMessage<T>>)(object)BufferAgentMessage<T>.NewError(error)); } virtual void IObserver<T>.OnCompleted() { ((FSharpMailboxProcessor<BufferAgentMessage<BufferAgentMessage<T>>>)(object)agent).Post((BufferAgentMessage<BufferAgentMessage<T>>)(object)BufferAgentMessage<T>.Completed); } virtual IDisposable IObservable<T>.Subscribe(IObserver<T> observer) { return subscribe(observer); } [CompilerGenerated] internal IDisposable subscribe(IObserver<T> observer) { ((FSharpMailboxProcessor<BufferAgentMessage<BufferAgentMessage<T>>>)(object)agent).Post((BufferAgentMessage<BufferAgentMessage<T>>)(object)BufferAgentMessage<T>.NewAdd(observer)); return new $Observable.clo@527-1<T>(this, observer); } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class Subject<T> : ReplaySubject<T> { public Subject() : base(0) { } } [Serializable] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [NoEquality] [NoComparison] [DebuggerDisplay("{__DebugDisplay(),nq}")] [CompilationMapping(/*Could not decode attribute arguments.*/)] public abstract class AsyncResult<T> { public static class Tags { public const int AsyncOk = 0; public const int AsyncException = 1; public const int AsyncCanceled = 2; } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(AsyncResult<>.AsyncOk@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] public class AsyncOk : AsyncResult<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly T item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public T Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(AsyncResult<>))] [CompilerGenerated] [DebuggerNonUserCode] internal AsyncOk(T item) { this.item = item; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(AsyncResult<>.AsyncException@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] public class AsyncException : AsyncResult<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly Exception item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public Exception Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(AsyncResult<>))] [CompilerGenerated] [DebuggerNonUserCode] internal AsyncException(Exception item) { this.item = item; } } [Serializable] [SpecialName] [DebuggerTypeProxy(typeof(AsyncResult<>.AsyncCanceled@DebugTypeProxy))] [DebuggerDisplay("{__DebugDisplay(),nq}")] public class AsyncCanceled : AsyncResult<T> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly OperationCanceledException item; [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public OperationCanceledException Item { [CompilerGenerated] [DebuggerNonUserCode] get { return item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(AsyncResult<>))] [CompilerGenerated] [DebuggerNonUserCode] internal AsyncCanceled(OperationCanceledException item) { this.item = item; } } [SpecialName] internal class AsyncOk@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public T Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(AsyncResult<>))] [CompilerGenerated] [DebuggerNonUserCode] public AsyncOk@DebugTypeProxy(AsyncOk obj) { _obj = obj; } } [SpecialName] internal class AsyncException@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public Exception Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(AsyncResult<>))] [CompilerGenerated] [DebuggerNonUserCode] public AsyncException@DebugTypeProxy(AsyncException obj) { _obj = obj; } } [SpecialName] internal class AsyncCanceled@DebugTypeProxy { [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public OperationCanceledException Item { [CompilerGenerated] [DebuggerNonUserCode] get { return _obj.item; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(AsyncResult<>))] [CompilerGenerated] [DebuggerNonUserCode] public AsyncCanceled@DebugTypeProxy(AsyncCanceled obj) { _obj = obj; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public int Tag { [CompilerGenerated] [DebuggerNonUserCode] get { return (this is AsyncCanceled) ? 2 : ((this is AsyncException) ? 1 : 0); } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsAsyncOk { [CompilerGenerated] [DebuggerNonUserCode] get { return this is AsyncOk; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsAsyncException { [CompilerGenerated] [DebuggerNonUserCode] get { return this is AsyncException; } } [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public bool IsAsyncCanceled { [CompilerGenerated] [DebuggerNonUserCode] get { return this is AsyncCanceled; } } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(AsyncResult<>))] [CompilerGenerated] [DebuggerNonUserCode] internal AsyncResult() { } [CompilationMapping(/*Could not decode attribute arguments.*/)] public static AsyncResult<T> NewAsyncOk(T item) { return new AsyncOk(item); } [CompilationMapping(/*Could not decode attribute arguments.*/)] public static AsyncResult<T> NewAsyncException(Exception item) { return new AsyncException(item); } [CompilationMapping(/*Could not decode attribute arguments.*/)] public static AsyncResult<T> NewAsyncCanceled(OperationCanceledException item) { return new AsyncCanceled(item); } [SpecialName] [CompilerGenerated] [DebuggerNonUserCode] internal object __DebugDisplay() { return ((FSharpFunc<AsyncResult<AsyncResult<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<AsyncResult<T>, string>>((PrintfFormat<FSharpFunc<AsyncResult<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<AsyncResult<FSharpFunc<AsyncResult<T>, string>>, string>, Unit, string, string, string>("%+0.8A"))).Invoke((AsyncResult<AsyncResult<T>>)(object)this); } [CompilerGenerated] public override string ToString() { return ((FSharpFunc<AsyncResult<AsyncResult<T>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<AsyncResult<T>, string>>((PrintfFormat<FSharpFunc<AsyncResult<T>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<AsyncResult<FSharpFunc<AsyncResult<T>, string>>, string>, Unit, string, string, AsyncResult<FSharpFunc<AsyncResult<T>, string>>>("%+A"))).Invoke((AsyncResult<AsyncResult<T>>)(object)this); } public static FSharpAsync<T> Commit(AsyncResult<T> res) { return FSharpAsync.FromContinuations<T>((FSharpFunc<Tuple<FSharpFunc<T, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>)new $AsyncOperations.Commit@18<T>(res)); } } [Serializable] [Sealed] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class AsyncResultCell<T> { internal FSharpOption<AsyncResult<T>> result; internal FSharpList<FSharpFunc<AsyncResult<T>, Unit>> savedConts; internal object syncRoot; internal FSharpAsync<AsyncResult<T>> AsyncPrimitiveResult => FSharpAsync.FromContinuations<AsyncResult<T>>((FSharpFunc<Tuple<FSharpFunc<AsyncResult<T>, Unit>, FSharpFunc<Exception, Unit>, FSharpFunc<OperationCanceledException, Unit>>, Unit>)new $AsyncOperations.get_AsyncPrimitiveResult@63<T>(this)); public FSharpAsync<T> AsyncResult => ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<T>((FSharpFunc<Unit, FSharpAsync<T>>)new $AsyncOperations.get_AsyncResult@81<T>(this)); public AsyncResultCell() { result = null; savedConts = FSharpList<FSharpFunc<AsyncResult<FSharpFunc<AsyncResult<T>, Unit>>, Unit>>.Empty; syncRoot = new object(); } public void RegisterResult(AsyncResult<T> res, [OptionalArgument] FSharpOption<bool> reuseThread) { FSharpList<FSharpFunc<AsyncResult<T>, Unit>> val; lock (syncRoot) { val = $AsyncOperations.action@1-2(this, res, null); } FSharpList<FSharpFunc<AsyncResult<T>, Unit>> val2 = val; bool flag = Operators.DefaultArg<bool>(reuseThread, false); if (((FSharpList<FSharpFunc<AsyncResult<FSharpFunc<AsyncResult<T>, Unit>>, Unit>>)(object)val2).TailOrNull == null) { return; } val = val2; if (((FSharpList<FSharpFunc<AsyncResult<FSharpFunc<AsyncResult<T>, Unit>>, Unit>>)(object)((FSharpList<FSharpFunc<AsyncResult<FSharpFunc<AsyncResult<T>, Unit>>, Unit>>)(object)val).TailOrNull).TailOrNull == null) { if (flag) { FSharpFunc<AsyncResult<T>, Unit> headOrDefault = ((FSharpList<FSharpFunc<AsyncResult<FSharpFunc<AsyncResult<T>, Unit>>, Unit>>)(object)val).HeadOrDefault; ((FSharpFunc<AsyncResult<AsyncResult<T>>, Unit>)(object)headOrDefault).Invoke((AsyncResult<AsyncResult<T>>)(object)res); return; } FSharpList<FSharpFunc<AsyncResult<T>, Unit>> val3 = val2; } else { FSharpList<FSharpFunc<AsyncResult<T>, Unit>> val3 = val2; } SynchronizationContext current = SynchronizationContext.Current; ListModule.Iterate<FSharpFunc<AsyncResult<T>, Unit>>((FSharpFunc<FSharpFunc<AsyncResult<T>, Unit>, Unit>)((current != null) ? ((object)new $AsyncOperations.RegisterResult@58-2<T>(res, current)) : ((object)new $AsyncOperations.RegisterResult@57<T>(res))), val2); } } [Serializable] [CompilationMapping(/*Could not decode attribute arguments.*/)] public class AsyncWorker<T> { internal FSharpAsync<T> p; internal CancellationTokenSource cts; internal SynchronizationContext syncContext; internal FSharpEvent<T> completed; internal FSharpEvent<Exception> error; internal FSharpEvent<OperationCanceledException> canceled; internal FSharpEvent<int> progress; public IEvent<FSharpHandler<int>, int> ProgressChanged => progress.Publish; public IEvent<FSharpHandler<T>, T> Completed => completed.Publish; public IEvent<FSharpHandler<OperationCanceledException>, OperationCanceledException> Canceled => canceled.Publish; public IEvent<FSharpHandler<Exception>, Exception> Error => error.Publish; public AsyncWorker(FSharpAsync<T> p, [OptionalArgument] FSharpOption<CancellationToken> cancellationToken) { this.p = p; CancellationTokenSource cancellationTokenSource; if (cancellationToken == null) { cancellationTokenSource = new CancellationTokenSource(); } else { CancellationToken value = cancellationToken.Value; CancellationTokenSource cancellationTokenSource2 = new CancellationTokenSource(); cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(value, cancellationTokenSource2.Token); } cts = cancellationTokenSource; syncContext = null; completed = new FSharpEvent<T>(); error = new FSharpEvent<Exception>(); canceled = new FSharpEvent<OperationCanceledException>(); progress = new FSharpEvent<int>(); } public void ReportProgress(int progressPercentage) { raiseEventOnGuiThread(progress, progressPercentage); } public bool RunAsync() { if (syncContext != null) { throw new InvalidOperationException("The operation is already in progress. RunAsync can't be called twice"); } SynchronizationContext current = SynchronizationContext.Current; syncContext = ((current != null) ? current : new SynchronizationContext()); return ThreadPool.QueueUserWorkItem(new $AsyncWorker.RunAsync@55<T>(this).Invoke); } public void CancelAsync([OptionalArgument] FSharpOption<string> message) { cts.Cancel(); } [CompilationArgumentCounts(new int[] { 1, 1 })] [CompilerGenerated] internal void raiseEventOnGuiThread<b>(FSharpEvent<b> @event, b args) { syncContext.Post(new $AsyncWorker.clo@27-2<b>(@event, args).Invoke, null); } [CompilerGenerated] internal void doWork() { FSharpAsync.StartWithContinuations<T>(p, (FSharpFunc<T, Unit>)new $AsyncWorker.clo@38-3<T>(this), (FSharpFunc<Exception, Unit>)new $AsyncWorker.clo@39-4<T>(this), (FSharpFunc<OperationCanceledException, Unit>)new $AsyncWorker.clo@40-5<T>(this), FSharpOption<CancellationToken>.Some(cts.Token)); } } [Serializable] [Sealed] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class AsyncStreamReader : IDisposable { internal static int defaultBufferSize; internal static int minBufferSize; internal Stream stream@47; internal Decoder decoder; internal Encoding encoding@49; internal int _maxCharsPerBuffer; internal byte[] byteBuffer; internal char[] charBuffer; internal byte[] preamble; internal int charPos; internal int charLen; internal int byteLen; internal int bytePos; internal bool _detectEncoding; internal bool _checkPreamble; internal static int init@16; public Encoding CurrentEncoding => encoding@49; public Stream BaseStream => stream@47; public FSharpAsync<bool> EndOfStream => ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<bool>((FSharpFunc<Unit, FSharpAsync<bool>>)new $AsyncStreamReader.get_EndOfStream@290(this)); public AsyncStreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize) { if (HashCompare.GenericEqualityIntrinsic<Stream>(stream, (Stream)null) || HashCompare.GenericEqualityIntrinsic<Encoding>(encoding, (Encoding)null)) { throw new ArgumentNullException((!HashCompare.GenericEqualityIntrinsic<Stream>(stream, (Stream)null)) ? "encoding" : "stream"); } if (!stream.CanRead) { throw new ArgumentException("stream not readable", "stream"); } if (stream is FileStream fileStream && !fileStream.IsAsync) { FileStream fileStream2 = fileStream; throw new ArgumentException("FileStream not asynchronous. AsyncStreamReader should only be used on FileStream if the IsAsync property returns true. Consider passing 'true' for the async flag in the FileStream constructor", "stream"); } if (bufferSize <= 0) { ArgumentOutOfRangeException ex = new ArgumentOutOfRangeException("bufferSize"); throw ex; } stream@47 = stream; decoder = encoding.GetDecoder(); encoding@49 = encoding; if (init@16 < 6) { IntrinsicFunctions.FailStaticInit(); } int num = minBufferSize; int num2 = ((bufferSize >= num) ? bufferSize : num); _maxCharsPerBuffer = encoding@49.GetMaxCharCount(num2); byteBuffer = ArrayModule.ZeroCreate<byte>(num2); charBuffer = ArrayModule.ZeroCreate<char>(_maxCharsPerBuffer); preamble = encoding@49.GetPreamble(); charPos = 0; charLen = 0; byteLen = 0; bytePos = 0; _detectEncoding = detectEncodingFromByteOrderMarks; _checkPreamble = preamble.Length > 0; } public AsyncStreamReader(Stream stream) : this(stream, detectEncodingFromByteOrderMarks: true) { } public AsyncStreamReader(Stream stream, bool detectEncodingFromByteOrderMarks) { Encoding uTF = Encoding.UTF8; if (init@16 < 4) { IntrinsicFunctions.FailStaticInit(); } this..ctor(stream, uTF, detectEncodingFromByteOrderMarks, defaultBufferSize); } public AsyncStreamReader(Stream stream, Encoding encoding) { if (init@16 < 4) { IntrinsicFunctions.FailStaticInit(); } this..ctor(stream, encoding, detectEncodingFromByteOrderMarks: true, defaultBufferSize); } public AsyncStreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks) { if (init@16 < 4) { IntrinsicFunctions.FailStaticInit(); } this..ctor(stream, encoding, detectEncodingFromByteOrderMarks, defaultBufferSize); } public void Close() { cleanup(); } public void DiscardBufferedData() { byteLen = 0; charLen = 0; charPos = 0; decoder = encoding@49.GetDecoder(); } public FSharpAsync<int> Peek() { return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<int>((FSharpFunc<Unit, FSharpAsync<int>>)new $AsyncStreamReader.Peek@302(this)); } public FSharpAsync<char> Read() { return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<char>((FSharpFunc<Unit, FSharpAsync<char>>)new $AsyncStreamReader.Read@307(this)); } public FSharpAsync<int> ReadExactly(char[] buffer, int index, int count) { return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<int>((FSharpFunc<Unit, FSharpAsync<int>>)new $AsyncStreamReader.ReadExactly@326(this, buffer, index, count)); } public FSharpAsync<int> Read(char[] buffer, int index, int count) { return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<int>((FSharpFunc<Unit, FSharpAsync<int>>)new $AsyncStreamReader.Read@339-9(this, buffer, index, count)); } public FSharpAsync<string> ReadToEnd() { return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<string>((FSharpFunc<Unit, FSharpAsync<string>>)new $AsyncStreamReader.ReadToEnd@367(this)); } public FSharpAsync<string> ReadLine() { return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<string>((FSharpFunc<Unit, FSharpAsync<string>>)new $AsyncStreamReader.ReadLine@394(this)); } virtual void IDisposable.Dispose() { cleanup(); } [CompilerGenerated] internal a readerClosed<a>() { throw new InvalidOperationException("reader closed"); } [CompilerGenerated] internal void compressBuffer(int n) { Buffer.BlockCopy(byteBuffer, n, byteBuffer, 0, byteLen - n); byteLen -= n; } [CompilerGenerated] internal bool isPreamble() { if (!_checkPreamble) { return _checkPreamble; } int num = ((byteLen < preamble.Length) ? (byteLen - bytePos) : (preamble.Length - bytePos)); bool flag = false; int num2 = 0; while (num2 < num && !flag) { if (byteBuffer[bytePos] != preamble[bytePos]) { bytePos = 0; _checkPreamble = false; flag = true; } if (!flag) { num2++; bytePos++; } } if (_checkPreamble && bytePos == preamble.Length) { compressBuffer(preamble.Length); bytePos = 0; _checkPreamble = false; _detectEncoding = false; } return _checkPreamble; } [CompilerGenerated] internal void detectEncoding() { if (byteLen < 2) { return; } _detectEncoding = false; bool flag = false; if (byteBuffer[0] == 254 && byteBuffer[1] == byte.MaxValue) { encoding@49 = new UnicodeEncoding(bigEndian: true, byteOrderMark: true); compressBuffer(2); flag = true; } else if (byteBuffer[0] == byte.MaxValue && byteBuffer[1] == 254) { if (byteLen >= 4 && byteBuffer[2] == 0 && byteBuffer[3] == 0) { encoding@49 = new UTF32Encoding(bigEndian: false, byteOrderMark: true); compressBuffer(4); } else { encoding@49 = new UnicodeEncoding(bigEndian: false, byteOrderMark: true); compressBuffer(2); } flag = true; } else if (byteLen >= 3 && byteBuffer[0] == 239 && byteBuffer[1] == 187 && byteBuffer[2] == 191) { encoding@49 = Encoding.UTF8; compressBuffer(3); flag = true; } else if (byteLen >= 4 && byteBuffer[0] == 0 && byteBuffer[1] == 0 && byteBuffer[2] == 254 && byteBuffer[3] == byte.MaxValue) { encoding@49 = new UTF32Encoding(bigEndian: true, byteOrderMark: true); flag = true; } else if (byteLen == 2) { _detectEncoding = true; } if (flag) { decoder = encoding@49.GetDecoder(); _maxCharsPerBuffer = encoding@49.GetMaxCharCount(byteBuffer.Length); charBuffer = ArrayModule.ZeroCreate<char>(_maxCharsPerBuffer); } } [CompilerGenerated] internal FSharpAsync<int> readBuffer() { return ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<int>((FSharpFunc<Unit, FSharpAsync<int>>)new $AsyncStreamReader.clo@159-6(this)); } [CompilerGenerated] internal void cleanup() { try { Stream stream = stream@47; if (!HashCompare.GenericEqualityIntrinsic<Stream>(stream, (Stream)null)) { stream@47.Close(); } } finally { Stream stream = stream@47; if (!HashCompare.GenericEqualityIntrinsic<Stream>(stream, (Stream)null)) { stream@47 = null; encoding@49 = null; decoder = null; byteBuffer = null; charBuffer = null; charPos = 0; charLen = 0; } } } static AsyncStreamReader() { $AsyncStreamReader.init@ = 0; _ = $AsyncStreamReader.init@; } } [Serializable] [StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)] [DebuggerDisplay("{__DebugDisplay(),nq}")] [CompilationMapping(/*Could not decode attribute arguments.*/)] public sealed class AsyncStreamNode<a> { [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly a item1; [DebuggerBrowsable(DebuggerBrowsableState.Never)] [CompilerGenerated] [DebuggerNonUserCode] internal readonly FSharpAsync<AsyncStreamNode<a>> item2; [CompilerGenerated] [DebuggerNonUserCode] [DebuggerBrowsable(DebuggerBrowsableState.Never)] public int Tag { [CompilerGenerated] [DebuggerNonUserCode] get { return 0; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public a Item1 { [CompilerGenerated] [DebuggerNonUserCode] get { return item1; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] [CompilerGenerated] [DebuggerNonUserCode] public FSharpAsync<AsyncStreamNode<a>> Item2 { [CompilerGenerated] [DebuggerNonUserCode] get { return item2; } } [CompilationMapping(/*Could not decode attribute arguments.*/)] public static AsyncStreamNode<a> NewASN(a item1, FSharpAsync<AsyncStreamNode<a>> item2) { return new AsyncStreamNode<a>(item1, item2); } [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(AsyncStreamNode<>))] [CompilerGenerated] [DebuggerNonUserCode] internal AsyncStreamNode(a item1, FSharpAsync<AsyncStreamNode<a>> item2) { this.item1 = item1; this.item2 = item2; } [SpecialName] [CompilerGenerated] [DebuggerNonUserCode] internal object __DebugDisplay() { return ((FSharpFunc<AsyncStreamNode<AsyncStreamNode<a>>, string>)(object)ExtraTopLevelOperators.PrintFormatToString<FSharpFunc<AsyncStreamNode<a>, string>>((PrintfFormat<FSharpFunc<AsyncStreamNode<a>, string>, Unit, string, string>)(object)new PrintfFormat<FSharpFunc<AsyncStreamNode<FSharpFunc<AsyncStreamNode<a>, string>>, string>, Unit, string, string, string>("%+0.8A"))).Invoke((AsyncStreamNode<AsyncStreamNode<a>>)(object)this); } [CompilerGenerated] public override string ToString() { return ((FSharpFunc<AsyncStreamNode<AsyncStreamNode<a>>, string>)(object)ExtraTopLevelOperators.Pri