// Decompiled with JetBrains decompiler
// Type: .
// Assembly: WindowsBC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9909ee17073e3364
// MVID: 658BFC85-36E1-493D-98E6-AE9127D73D60
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare.00004-msil\Trojan-Downloader.MSIL.BitCoinMiner.c-64f742a0b28b2c3d2a62ef6607fcfd5fa55b793a1aff3a6c11e014e3b119149e.exe

using \u000E;
using \u0010\u0002;
using ICSharpCode.SharpZipLib.Tar;
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace \u0010\u0002
{
  internal sealed class \u0014\u0002 : Stream
  {
    protected long \u0001;
    protected long \u0002;
    protected byte[] \u0003;
    protected \u0011\u0002 \u0004;
    private readonly Stream \u0005;

    [SpecialName]
    public override bool get_CanRead() => \u0007\u0003.\u007E\u009E\u0004((object) this.\u0005);

    [SpecialName]
    public override bool get_CanSeek() => false;

    [SpecialName]
    public override bool get_CanWrite() => false;

    [SpecialName]
    public override long get_Length() => \u007F\u0004.\u007E\u0003\u0005((object) this.\u0005);

    [SpecialName]
    public override long get_Position() => \u007F\u0004.\u007E\u0004\u0005((object) this.\u0005);

    [SpecialName]
    public override void set_Position([In] long obj0) => throw new NotSupportedException(\u0008.\u000E\u0003(2613));

    public override void Flush() => \u0093\u0003.\u007E\u0007\u0005((object) this.\u0005);

    public override long Seek([In] long obj0, [In] SeekOrigin obj1) => throw new NotSupportedException(\u0008.\u000E\u0003(2613));

    public override void SetLength([In] long obj0) => throw new NotSupportedException(\u0008.\u000E\u0003(2658));

    public override void Write([In] byte[] obj0, [In] int obj1, [In] int obj2) => throw new NotSupportedException(\u0008.\u000E\u0003(2711));

    public override void WriteByte([In] byte obj0) => throw new NotSupportedException(\u0008.\u000E\u0003(2760));

    public override int ReadByte()
    {
      byte[] numArray = new byte[1];
      return \u0089\u0005.\u007E\u000F\u0005((object) this, numArray, 0, 1) <= 0 ? -1 : (int) numArray[0];
    }

    public override int Read([In] byte[] obj0, [In] int obj1, [In] int obj2)
    {
      if (obj0 == null)
        throw new ArgumentNullException(\u0008.\u000E\u0003(568));
      int num1 = 0;
      if (this.\u0002 >= this.\u0001)
        return 0;
      long num2 = (long) obj2;
      if (num2 + this.\u0002 > this.\u0001)
        num2 = this.\u0001 - this.\u0002;
      if (this.\u0003 != null)
      {
        int num3 = num2 > (long) this.\u0003.Length ? this.\u0003.Length : (int) num2;
        \u008F\u0003.\u0098((Array) this.\u0003, 0, (Array) obj0, obj1, num3);
        if (num3 >= this.\u0003.Length)
        {
          this.\u0003 = (byte[]) null;
        }
        else
        {
          int length = this.\u0003.Length - num3;
          byte[] numArray = new byte[length];
          \u008F\u0003.\u0098((Array) this.\u0003, num3, (Array) numArray, 0, length);
          this.\u0003 = numArray;
        }
        num1 += num3;
        num2 -= (long) num3;
        obj1 += num3;
      }
      while (num2 > 0L)
      {
        byte[] numArray = this.\u0004.\u009F\u0003();
        if (numArray == null)
          throw new TarException(\u0097\u0003.\u001D\u0002((object) \u0008.\u000E\u0003(2813), (object) num2, (object) \u0008.\u000E\u0003(2842)));
        int num4 = (int) num2;
        int length = numArray.Length;
        if (length > num4)
        {
          \u008F\u0003.\u0098((Array) numArray, 0, (Array) obj0, obj1, num4);
          this.\u0003 = new byte[length - num4];
          \u008F\u0003.\u0098((Array) numArray, num4, (Array) this.\u0003, 0, length - num4);
        }
        else
        {
          num4 = length;
          \u008F\u0003.\u0098((Array) numArray, 0, (Array) obj0, obj1, length);
        }
        num1 += num4;
        num2 -= (long) num4;
        obj1 += num4;
      }
      this.\u0002 += (long) num1;
      return num1;
    }

    public override void Close() => this.\u0004.Close();
  }
}
