// 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 ICSharpCode.SharpZipLib.Tar;
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace \u0010\u0002
{
  internal sealed class \u0011\u0002
  {
    private Stream \u0001;
    private Stream \u0002;
    private byte[] \u0003;
    private int \u0004;
    private int \u0005;
    private int \u0006 = 10240;
    private int \u0007 = 20;
    private bool \u0008 = true;

    [SpecialName]
    public int \u009D\u0003() => this.\u0006;

    [SpecialName]
    public int \u009E\u0003() => this.\u0007;

    protected \u0011\u0002()
    {
    }

    public byte[] \u009F\u0003()
    {
      if (this.\u0001 == null)
        throw new TarException(\u0008.\u000E\u0003(1870));
      if (this.\u0004 >= this.\u009E\u0003() && !this.\u0001\u0004())
        throw new TarException(\u0008.\u000E\u0003(1931));
      byte[] numArray = new byte[512];
      \u008F\u0003.\u0098((Array) this.\u0003, this.\u0004 * 512, (Array) numArray, 0, 512);
      ++this.\u0004;
      return numArray;
    }

    private bool \u0001\u0004()
    {
      if (this.\u0001 == null)
        throw new TarException(\u0008.\u000E\u0003(1964));
      this.\u0004 = 0;
      int num1 = 0;
      long num2;
      for (int index = this.\u009D\u0003(); index > 0; index -= (int) num2)
      {
        num2 = (long) \u0089\u0005.\u007E\u000F\u0005((object) this.\u0001, this.\u0003, num1, index);
        if (num2 > 0L)
          num1 += (int) num2;
        else
          break;
      }
      ++this.\u0005;
      return true;
    }

    public void \u0002\u0004([In] byte[] obj0)
    {
      if (obj0 == null)
        throw new ArgumentNullException(\u0008.\u000E\u0003(2005));
      if (this.\u0002 == null)
        throw new TarException(\u0008.\u000E\u0003(2014));
      if (obj0.Length != 512)
        throw new TarException(\u001D\u0003.\u001A\u0002(\u0008.\u000E\u0003(2079), (object) obj0.Length, (object) 512));
      if (this.\u0004 >= this.\u009E\u0003())
        this.\u0003\u0004();
      \u008F\u0003.\u0098((Array) obj0, 0, (Array) this.\u0003, this.\u0004 * 512, 512);
      ++this.\u0004;
    }

    public void \u0002\u0004([In] byte[] obj0, [In] int obj1)
    {
      if (obj0 == null)
        throw new ArgumentNullException(\u0008.\u000E\u0003(568));
      if (this.\u0002 == null)
        throw new TarException(\u0008.\u000E\u0003(2204));
      if (obj1 < 0 || obj1 >= obj0.Length)
        throw new ArgumentOutOfRangeException(\u0008.\u000E\u0003(577));
      if (obj1 + 512 > obj0.Length)
        throw new TarException(\u0091\u0004.\u001B\u0002(\u0008.\u000E\u0003(2277), (object) obj0.Length, (object) obj1, (object) this.\u0006));
      if (this.\u0004 >= this.\u009E\u0003())
        this.\u0003\u0004();
      \u008F\u0003.\u0098((Array) obj0, obj1, (Array) this.\u0003, this.\u0004 * 512, 512);
      ++this.\u0004;
    }

    private void \u0003\u0004()
    {
      if (this.\u0002 == null)
        throw new TarException(\u0008.\u000E\u0003(2423));
      \u001F\u0004.\u007E\u0011\u0005((object) this.\u0002, this.\u0003, 0, this.\u009D\u0003());
      \u0093\u0003.\u007E\u0007\u0005((object) this.\u0002);
      this.\u0004 = 0;
      ++this.\u0005;
    }

    private void \u0004\u0004()
    {
      if (this.\u0002 == null)
        throw new TarException(\u0008.\u000E\u0003(2488));
      if (this.\u0004 > 0)
      {
        int num = this.\u0004 * 512;
        \u0099\u0004.\u0099((Array) this.\u0003, num, this.\u009D\u0003() - num);
        this.\u0003\u0004();
      }
      \u0093\u0003.\u007E\u0007\u0005((object) this.\u0002);
    }

    public void Close()
    {
      if (this.\u0002 == null)
      {
        if (this.\u0001 == null)
          return;
        if (this.\u0008)
          \u0093\u0003.\u007E\u0006\u0005((object) this.\u0001);
        this.\u0001 = (Stream) null;
      }
      else
      {
        this.\u0004\u0004();
        if (this.\u0008)
          \u0093\u0003.\u007E\u0006\u0005((object) this.\u0002);
        this.\u0002 = (Stream) null;
      }
    }
  }
}
