namespace ns1
{
    using System;
    using System.IO;
    using System.Text;

    internal class Class8 : BinaryReader
    {
        private static byte[] byte_0 = new byte[0x100];
        private const int int_0 = 0x100;

        public Class8(Stream imput) : base(imput)
        {
        }

        public Class8(Stream imput, Encoding encoding) : base(imput, encoding)
        {
        }

        private string method_0(uint uint_0)
        {
            string str;
            if (uint_0 > 0x100)
            {
                str = this.method_7(uint_0 - 0x100);
            }
            else
            {
                str = string.Empty;
            }
            this.Read(byte_0, 0, (int) uint_0);
            return (str + Encoding.UTF7.GetString(byte_0, 0, (int) uint_0));
        }

        public byte[] method_1(uint uint_0)
        {
            byte[] buffer = new byte[uint_0];
            for (uint i = 0; i < uint_0; i++)
            {
                buffer[i] = this.ReadByte();
            }
            return buffer;
        }

        public uint[] method_10(uint uint_0)
        {
            uint[] numArray = new uint[uint_0];
            for (uint i = 0; i < uint_0; i++)
            {
                numArray[i] = this.ReadUInt32();
            }
            return numArray;
        }

        public long method_11(long long_0, SeekOrigin seekOrigin_0)
        {
            return this.BaseStream.Seek(long_0, seekOrigin_0);
        }

        public long method_12(long long_0)
        {
            return this.method_11(long_0, SeekOrigin.Current);
        }

        public int method_2(int int_1)
        {
            switch (int_1)
            {
                case 1:
                    return this.ReadSByte();

                case 2:
                    return this.ReadInt16();

                case 4:
                    return this.ReadInt32();
            }
            throw new ArgumentException();
        }

        public short[] method_3(uint uint_0)
        {
            short[] numArray = new short[uint_0];
            for (uint i = 0; i < uint_0; i++)
            {
                numArray[i] = this.ReadInt16();
            }
            return numArray;
        }

        public int[] method_4(uint uint_0)
        {
            int[] numArray = new int[uint_0];
            for (uint i = 0; i < uint_0; i++)
            {
                numArray[i] = this.ReadInt32();
            }
            return numArray;
        }

        public sbyte[] method_5(uint uint_0)
        {
            sbyte[] numArray = new sbyte[uint_0];
            for (uint i = 0; i < uint_0; i++)
            {
                numArray[i] = this.ReadSByte();
            }
            return numArray;
        }

        public string method_6(int int_1)
        {
            if (int_1 > 0)
            {
                return this.method_7((uint) int_1);
            }
            return string.Empty;
        }

        public string method_7(uint uint_0)
        {
            return this.method_0(uint_0).TrimEnd(new char[1]);
        }

        public uint method_8(int int_1)
        {
            switch (int_1)
            {
                case 1:
                    return this.ReadByte();

                case 2:
                    return this.ReadUInt16();

                case 4:
                    return this.ReadUInt32();
            }
            throw new ArgumentException();
        }

        public ushort[] method_9(uint uint_0)
        {
            ushort[] numArray = new ushort[uint_0];
            for (uint i = 0; i < uint_0; i++)
            {
                numArray[i] = this.ReadUInt16();
            }
            return numArray;
        }

        public override string ReadString()
        {
            int count = 0;
            for (byte i = this.ReadByte(); i != 0; i = this.ReadByte())
            {
                byte_0[count++] = i;
                if (count >= 0x100)
                {
                    break;
                }
            }
            string str = Encoding.UTF7.GetString(byte_0, 0, count);
            if (count == 0x100)
            {
                str = str + this.ReadString();
            }
            return str;
        }

        public long Length
        {
            get
            {
                return this.BaseStream.Length;
            }
        }

        public long Position
        {
            get
            {
                return this.BaseStream.Position;
            }
        }
    }
}

