Пример #1
0
        // Token: 0x0600065C RID: 1628 RVA: 0x00024ACC File Offset: 0x00022CCC
        private bool UULineGood()
        {
            this.encodedBytes = 0;
            int num = this.encodedSize;

            while (this.encodedSize > 0 && ByteEncoder.IsWhiteSpace(this.encoded[this.encodedSize - 1]))
            {
                this.encodedSize--;
            }
            if (this.encodedSize == 0)
            {
                return(true);
            }
            if (this.state == UUDecoder.State.Prologue)
            {
                if (ByteEncoder.BeginsWithNI(this.encoded, 0, UUDecoder.Prologue, this.encodedSize))
                {
                    int num2 = this.encodedSize - 6;
                    int num3 = 6;
                    while (num2 != 0 && ByteEncoder.IsWhiteSpace(this.encoded[num3]))
                    {
                        num3++;
                        num2--;
                    }
                    if (num2 == 0 || this.encoded[num3] < 48 || this.encoded[num3] > 55)
                    {
                        return(true);
                    }
                    do
                    {
                        num3++;
                        num2--;
                    }while (num2 != 0 && this.encoded[num3] >= 48 && this.encoded[num3] <= 55);
                    if (num2 == 0 || !ByteEncoder.IsWhiteSpace(this.encoded[num3]))
                    {
                        return(true);
                    }
                    do
                    {
                        num3++;
                        num2--;
                    }while (num2 != 0 && ByteEncoder.IsWhiteSpace(this.encoded[num3]));
                    if (num2 <= 128)
                    {
                        this.fileName = new byte[num2];
                        ByteEncoder.BlockCopy(this.encoded, num3, this.fileName, 0, num2);
                    }
                    return(true);
                }
            }
            else
            {
                if (this.state == UUDecoder.State.Ending)
                {
                    return(true);
                }
                if (ByteEncoder.BeginsWithNI(this.encoded, 0, UUDecoder.Prologue, this.encodedSize))
                {
                    return(true);
                }
            }
            if (true)
            {
                int num4 = (int)UUDecoder.UUDecode(this.encoded[0]);
                int num5 = 0;
                int num6 = num4 % 3;
                if (num6 != 0)
                {
                    num6++;
                    num5 = 4 - num6;
                }
                int num7 = 4 * (num4 / 3) + num6 + 1;
                if (this.encodedSize < num7)
                {
                    if (num < num7)
                    {
                        goto IL_285;
                    }
                    this.encodedSize = num7;
                }
                if (num7 != this.encodedSize && num7 + num5 != this.encodedSize)
                {
                    if (num7 + 1 == this.encodedSize || num7 + num5 + 1 == this.encodedSize)
                    {
                        this.encodedSize--;
                    }
                    else
                    {
                        if (num7 - 1 != this.encodedSize && num7 + num5 - 1 == this.encodedSize)
                        {
                            goto IL_285;
                        }
                        goto IL_285;
                    }
                }
                this.encodedBytes = num4;
                if (num5 != 0 && num7 == this.encodedSize)
                {
                    this.encoded[num7] = 32;
                    if (num5 > 1)
                    {
                        this.encoded[num7 + 1] = 32;
                    }
                    this.encodedSize += num5;
                }
                this.encodedSize--;
                this.encodedIndex = 1;
                if (this.encodedBytes == 0)
                {
                    this.state = UUDecoder.State.Ending;
                }
                else
                {
                    this.state = UUDecoder.State.Data;
                }
                return(true);
            }
IL_285:
            if (ByteEncoder.BeginsWithNI(this.encoded, 0, UUDecoder.Epilogue, this.encodedSize))
            {
                this.state = UUDecoder.State.Ending;
                return(true);
            }
            return(false);
        }
Пример #2
0
        // Token: 0x060005DE RID: 1502 RVA: 0x000210B0 File Offset: 0x0001F2B0
        private bool ReadLine(byte[] input, ref int inputIndex, ref int inputSize, bool flush)
        {
            if (this.state == BinHexUtils.State.Ending)
            {
                inputIndex += inputSize;
                inputSize   = 0;
                return(false);
            }
            bool result = false;

            while (inputSize != 0 || (flush && this.encodedSize != 0))
            {
                byte b = 10;
                if (inputSize != 0)
                {
                    inputSize--;
                    b = input[inputIndex++];
                }
                if (b != 10)
                {
                    if (this.encodedSize >= this.encoded.Length)
                    {
                        throw new ByteEncoderException(EncodersStrings.BinHexDecoderLineTooLong);
                    }
                    this.encoded[this.encodedSize++] = b;
                }
                else if (this.state == BinHexUtils.State.Starting)
                {
                    uint num = 0U;
                    while ((ulong)num < (ulong)((long)this.encodedSize))
                    {
                        if (!ByteEncoder.IsWhiteSpace(this.encoded[(int)((UIntPtr)num)]))
                        {
                            if ((ulong)((uint)((long)this.encodedSize - (long)((ulong)num))) >= (ulong)((long)BinHexDecoder.BinHexPrologue.Length) && ByteEncoder.BeginsWithNI(this.encoded, (int)num, BinHexDecoder.BinHexPrologue, BinHexDecoder.BinHexPrologue.Length))
                            {
                                this.state       = BinHexUtils.State.Started;
                                this.repeatCheck = false;
                                this.accumCount  = 0;
                                this.accum       = 0;
                                this.header      = null;
                                break;
                            }
                            throw new ByteEncoderException(EncodersStrings.BinHexDecoderLineCorrupt);
                        }
                        else
                        {
                            num += 1U;
                        }
                    }
                    this.encodedSize = 0;
                }
                else
                {
                    while (this.encodedSize != 0 && (this.encoded[this.encodedSize - 1] == 13 || this.encoded[this.encodedSize - 1] == 32 || this.encoded[this.encodedSize - 1] == 9))
                    {
                        this.encodedSize--;
                    }
                    if (this.encodedSize != 0)
                    {
                        result            = true;
                        this.encodedIndex = 0;
                        break;
                    }
                    if (this.state == BinHexUtils.State.Started)
                    {
                    }
                }
            }
            return(result);
        }