예제 #1
0
 private bool method_10()
 {
     this.enum14_0 = Enum14.Read;
     if (this.JsonToken_0 != JsonToken.StartObject)
     {
         return(false);
     }
     if (!this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮())
     {
         throw JsonReaderException.smethod_1(this, "Unexpected end when reading bytes.");
     }
     if (this.Object_0.ToString() == "$type")
     {
         this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮();
         if ((this.Object_0 != null) && this.Object_0.ToString().StartsWith("System.Byte[]"))
         {
             this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮();
             if (this.Object_0.ToString() == "$value")
             {
                 return(true);
             }
         }
     }
     throw JsonReaderException.smethod_1(this, "Error reading bytes. Unexpected token: {0}.".smethod_0(CultureInfo.InvariantCulture, JsonToken.StartObject));
 }
예제 #2
0
        internal int?method_7()
        {
            this.enum14_0 = Enum14.ReadAsInt32;
            while (this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮())
            {
                JsonToken token = this.JsonToken_0;
                if (token != JsonToken.Comment)
                {
                    switch (token)
                    {
                    case JsonToken.Integer:
                    case JsonToken.Float:
                        if (!(this.Object_0 is int))
                        {
                            this.SetToken(JsonToken.Integer, Convert.ToInt32(this.Object_0, CultureInfo.InvariantCulture));
                        }
                        return(new int?((int)this.Object_0));

                    case JsonToken.Null:
                        return(null);

                    case JsonToken.String:
                    {
                        int    num;
                        string str = (string)this.Object_0;
                        if (string.IsNullOrEmpty(str))
                        {
                            this.SetToken(JsonToken.Null);
                            return(null);
                        }
                        if (!int.TryParse(str, NumberStyles.Integer, this.Culture, out num))
                        {
                            throw JsonReaderException.smethod_1(this, "Could not convert string to integer: {0}.".smethod_0(CultureInfo.InvariantCulture, this.Object_0));
                        }
                        this.SetToken(JsonToken.Integer, num);
                        return(new int?(num));
                    }
                    }
                    if (token != JsonToken.EndArray)
                    {
                        throw JsonReaderException.smethod_1(this, "Error reading integer. Unexpected token: {0}.".smethod_0(CultureInfo.InvariantCulture, this.JsonToken_0));
                    }
                    return(null);
                }
            }
            this.SetToken(JsonToken.None);
            return(null);
        }
예제 #3
0
        internal DateTimeOffset?method_4()
        {
            this.enum14_0 = Enum14.ReadAsDateTimeOffset;
            while (this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮())
            {
                JsonToken token = this.JsonToken_0;
                if (token != JsonToken.Comment)
                {
                    switch (token)
                    {
                    case JsonToken.Date:
                        if (this.Object_0 is DateTime)
                        {
                            this.SetToken(JsonToken.Date, new DateTimeOffset((DateTime)this.Object_0));
                        }
                        return(new DateTimeOffset?((DateTimeOffset)this.Object_0));

                    case JsonToken.Null:
                        return(null);

                    case JsonToken.String:
                    {
                        DateTimeOffset offset;
                        string         str = (string)this.Object_0;
                        if (string.IsNullOrEmpty(str))
                        {
                            this.SetToken(JsonToken.Null);
                            return(null);
                        }
                        if (!DateTimeOffset.TryParse(str, this.Culture, DateTimeStyles.RoundtripKind, out offset))
                        {
                            throw JsonReaderException.smethod_1(this, "Could not convert string to DateTimeOffset: {0}.".smethod_0(CultureInfo.InvariantCulture, this.Object_0));
                        }
                        this.SetToken(JsonToken.Date, offset);
                        return(new DateTimeOffset?(offset));
                    }
                    }
                    if (token != JsonToken.EndArray)
                    {
                        throw JsonReaderException.smethod_1(this, "Error reading date. Unexpected token: {0}.".smethod_0(CultureInfo.InvariantCulture, token));
                    }
                    return(null);
                }
            }
            this.SetToken(JsonToken.None);
            return(null);
        }
예제 #4
0
 internal DateTime?method_9()
 {
     this.enum14_0 = Enum14.ReadAsDateTime;
     while (this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮())
     {
         if (this.JsonToken_0 != JsonToken.Comment)
         {
             if (this.JsonToken_0 == JsonToken.Date)
             {
                 return(new DateTime?((DateTime)this.Object_0));
             }
             if (this.JsonToken_0 != JsonToken.Null)
             {
                 if (this.JsonToken_0 == JsonToken.String)
                 {
                     DateTime time;
                     string   str = (string)this.Object_0;
                     if (string.IsNullOrEmpty(str))
                     {
                         this.SetToken(JsonToken.Null);
                         return(null);
                     }
                     if (!DateTime.TryParse(str, this.Culture, DateTimeStyles.RoundtripKind, out time))
                     {
                         throw JsonReaderException.smethod_1(this, "Could not convert string to DateTime: {0}.".smethod_0(CultureInfo.InvariantCulture, this.Object_0));
                     }
                     time = Class184.smethod_2(time, this.DateTimeZoneHandling);
                     this.SetToken(JsonToken.Date, time);
                     return(new DateTime?(time));
                 }
                 if (this.JsonToken_0 != JsonToken.EndArray)
                 {
                     throw JsonReaderException.smethod_1(this, "Error reading date. Unexpected token: {0}.".smethod_0(CultureInfo.InvariantCulture, this.JsonToken_0));
                 }
             }
             return(null);
         }
     }
     this.SetToken(JsonToken.None);
     return(null);
 }
예제 #5
0
        internal string method_8()
        {
            this.enum14_0 = Enum14.ReadAsString;
            while (this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮())
            {
                JsonToken token = this.JsonToken_0;
                if (token != JsonToken.Comment)
                {
                    switch (token)
                    {
                    case JsonToken.String:
                        return((string)this.Object_0);

                    case JsonToken.Null:
                        return(null);
                    }
                    if (smethod_0(token) && (this.Object_0 != null))
                    {
                        string str;
                        if (this.Object_0 is IFormattable)
                        {
                            str = ((IFormattable)this.Object_0).ToString(null, this.Culture);
                        }
                        else
                        {
                            str = this.Object_0.ToString();
                        }
                        this.SetToken(JsonToken.String, str);
                        return(str);
                    }
                    if (token != JsonToken.EndArray)
                    {
                        throw JsonReaderException.smethod_1(this, "Error reading string. Unexpected token: {0}.".smethod_0(CultureInfo.InvariantCulture, token));
                    }
                    return(null);
                }
            }
            this.SetToken(JsonToken.None);
            return(null);
        }
예제 #6
0
 internal JsonContract(Type underlyingType)
 {
     Class203.smethod_2(underlyingType, "underlyingType");
     this.UnderlyingType = underlyingType;
     this.bool_2         = underlyingType.smethod_9();
     this.bool_5         = !underlyingType.smethod_3() && !underlyingType.smethod_10();
     this.bool_0         = Class194.smethod_9(underlyingType);
     this.type_0         = (!this.bool_0 || !Class194.smethod_10(underlyingType)) ? underlyingType : Nullable.GetUnderlyingType(underlyingType);
     this.CreatedType    = this.type_0;
     this.bool_1         = Class181.smethod_3(this.type_0);
     this.bool_3         = this.type_0.smethod_7();
     if (this.type_0 == typeof(byte[]))
     {
         this.enum14_0 = Enum14.ReadAsBytes;
     }
     else if (this.type_0 == typeof(int))
     {
         this.enum14_0 = Enum14.ReadAsInt32;
     }
     else if (this.type_0 == typeof(decimal))
     {
         this.enum14_0 = Enum14.ReadAsDecimal;
     }
     else if (this.type_0 == typeof(string))
     {
         this.enum14_0 = Enum14.ReadAsString;
     }
     else if (this.type_0 == typeof(DateTime))
     {
         this.enum14_0 = Enum14.ReadAsDateTime;
     }
     else if (this.type_0 == typeof(DateTimeOffset))
     {
         this.enum14_0 = Enum14.ReadAsDateTimeOffset;
     }
     else
     {
         this.enum14_0 = Enum14.Read;
     }
 }
예제 #7
0
 // Token: 0x06001123 RID: 4387
 // RVA: 0x000106C7 File Offset: 0x0000E8C7
 private Class138(int int_4, int int_5, int int_6, int int_7, Enum14 enum14_1)
 {
     this.int_0 = int_4;
     this.int_2 = int_5;
     this.int_3 = int_6;
     this.int_1 = int_7;
     this.enum14_0 = enum14_1;
 }
예제 #8
0
        internal byte[] method_5()
        {
            this.enum14_0 = Enum14.ReadAsBytes;
            while (this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮())
            {
                JsonToken token = this.JsonToken_0;
                if (token != JsonToken.Comment)
                {
                    List <byte> list;
                    if (this.method_10())
                    {
                        byte[] buffer = this.ReadAsBytes();
                        this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮();
                        this.SetToken(JsonToken.Bytes, buffer);
                        return(buffer);
                    }
                    switch (token)
                    {
                    case JsonToken.String:
                    {
                        string s       = (string)this.Object_0;
                        byte[] buffer2 = (s.Length == 0) ? new byte[0] : Convert.FromBase64String(s);
                        this.SetToken(JsonToken.Bytes, buffer2);
                        return(buffer2);
                    }

                    case JsonToken.Null:
                        return(null);

                    case JsonToken.Bytes:
                        return((byte[])this.Object_0);

                    default:
                        if (token != JsonToken.StartArray)
                        {
                            if (token != JsonToken.EndArray)
                            {
                                throw JsonReaderException.smethod_1(this, "Error reading bytes. Unexpected token: {0}.".smethod_0(CultureInfo.InvariantCulture, token));
                            }
                            return(null);
                        }
                        list = new List <byte>();
                        break;
                    }
                    while (this.Newtonsoft.Json.JsonReader.‪​‮‫​​​‏‪​‭‎‫​‌‏‫‪‫‭‮‬‬‭​‏‭‫‎‍‮())
                    {
                        token = this.JsonToken_0;
                        switch (token)
                        {
                        case JsonToken.Comment:
                        {
                            continue;
                        }

                        case JsonToken.Integer:
                        {
                            list.Add(Convert.ToByte(this.Object_0, CultureInfo.InvariantCulture));
                            continue;
                        }

                        case JsonToken.EndArray:
                        {
                            byte[] buffer3 = list.ToArray();
                            this.SetToken(JsonToken.Bytes, buffer3);
                            return(buffer3);
                        }
                        }
                        throw JsonReaderException.smethod_1(this, "Unexpected token when reading bytes: {0}.".smethod_0(CultureInfo.InvariantCulture, token));
                    }
                    throw JsonReaderException.smethod_1(this, "Unexpected end when reading bytes.");
                }
            }
            this.SetToken(JsonToken.None);
            return(null);
        }
        // Token: 0x06002B58 RID: 11096 RVA: 0x000A8164 File Offset: 0x000A6364
        public static void smethod_0(Stream data_stream, Stream destination_stream, Bitmap destination_bitmap, Color?backGroundColor, bool convert_to_grayscale, Enum14 format)
        {
            using (Bitmap bitmap = (Bitmap)Image.FromStream(data_stream))
            {
                if (destination_bitmap != null && backGroundColor != null)
                {
                    if (destination_bitmap.Width == bitmap.Width)
                    {
                        if (destination_bitmap.Height == bitmap.Height)
                        {
                            using (Graphics graphics = Graphics.FromImage(destination_bitmap))
                            {
                                using (SolidBrush solidBrush = new SolidBrush(backGroundColor.Value))
                                {
                                    graphics.SmoothingMode      = SmoothingMode.HighQuality;
                                    graphics.InterpolationMode  = InterpolationMode.High;
                                    graphics.CompositingQuality = CompositingQuality.HighQuality;
                                    graphics.FillRectangle(solidBrush, 0, 0, destination_bitmap.Width, destination_bitmap.Height);
                                    graphics.DrawImage(bitmap, 0, 0, bitmap.Width, bitmap.Height);
                                }
                                goto IL_B2;
                            }
                        }
                    }
                    throw new ArgumentException("Destination dimensions do not match source image dimensions.");
                }
IL_B2:
                if (convert_to_grayscale)
                {
                    Class125.smethod_1(bitmap);
                }
                using (Stream3 stream = new Stream3(destination_stream))
                {
                    using (BinaryWriter binaryWriter = new BinaryWriter(stream))
                    {
                        stream.smethod_37(Class486.short_0);
                        stream.WriteByte(1);
                        stream.WriteByte(1);
                        short num;
                        short value;
                        switch (format)
                        {
                        case Enum14.const_0:
                            num   = 4;
                            value = 3;
                            break;

                        case Enum14.const_1:
                            num   = 3;
                            value = 3;
                            break;

                        case Enum14.const_2:
                            num   = 2;
                            value = 3;
                            break;

                        case Enum14.const_3:
                            num   = 1;
                            value = 2;
                            break;

                        default:
                            throw new NotSupportedException(string.Format("The specified format: '{0}' is not supported.", format));
                        }
                        stream.smethod_37(value);
                        stream.smethod_37((short)bitmap.Width);
                        stream.smethod_37((short)bitmap.Height);
                        stream.smethod_37(num);
                        stream.smethod_35(0);
                        stream.smethod_35(255);
                        binaryWriter.Write(new byte[4]);
                        binaryWriter.Write(new byte[80]);
                        stream.smethod_35(0);
                        binaryWriter.Write(new byte[404]);
                        for (int i = 0; i < (int)num; i++)
                        {
                            for (int j = 0; j < bitmap.Height; j++)
                            {
                                stream.smethod_35(0);
                            }
                            for (int k = 0; k < bitmap.Height; k++)
                            {
                                stream.smethod_35(0);
                            }
                        }
                        Class486.Class487[] array = new Class486.Class487[bitmap.Height];
                        if (destination_bitmap == null)
                        {
                            array = new Class486.Class487[bitmap.Height * (int)num];
                            Struct33[,] array2 = new Struct33[bitmap.Width, bitmap.Height];
                            Class486.smethod_4(bitmap, array2);
                            switch (format)
                            {
                            case Enum14.const_0:
                            case Enum14.const_1:
                                for (int l = (int)(num - 1); l >= 0; l--)
                                {
                                    int num2 = ((int)(num - 1) - l) * bitmap.Height;
                                    for (int m = 0; m < bitmap.Height; m++)
                                    {
                                        Class486.Class487 @class = array[num2 + m] = new Class486.Class487();
                                        @class.byte_0 = new byte[bitmap.Width];
                                        for (int n = 0; n < bitmap.Width; n++)
                                        {
                                            switch (l)
                                            {
                                            case 0:
                                                @class.byte_0[n] = array2[n, m].R;
                                                break;

                                            case 1:
                                                @class.byte_0[n] = array2[n, m].G;
                                                break;

                                            case 2:
                                                @class.byte_0[n] = array2[n, m].B;
                                                break;

                                            case 3:
                                                @class.byte_0[n] = array2[n, m].A;
                                                break;
                                            }
                                        }
                                    }
                                }
                                break;

                            case Enum14.const_2:
                                for (int num3 = (int)(num - 1); num3 >= 0; num3--)
                                {
                                    int num4 = ((int)(num - 1) - num3) * bitmap.Height;
                                    for (int num5 = 0; num5 < bitmap.Height; num5++)
                                    {
                                        Class486.Class487 class2 = array[num4 + num5] = new Class486.Class487();
                                        class2.byte_0 = new byte[bitmap.Width];
                                        for (int num6 = 0; num6 < bitmap.Width; num6++)
                                        {
                                            switch (num3)
                                            {
                                            case 0:
                                                class2.byte_0[num6] = array2[num6, num5].R;
                                                break;

                                            case 1:
                                                class2.byte_0[num6] = array2[num6, num5].A;
                                                break;
                                            }
                                        }
                                    }
                                }
                                break;

                            case Enum14.const_3:
                                for (int num7 = 0; num7 < bitmap.Height; num7++)
                                {
                                    array[num7]        = new Class486.Class487();
                                    array[num7].byte_0 = new byte[bitmap.Width];
                                    for (int num8 = 0; num8 < bitmap.Width; num8++)
                                    {
                                        array[num7].byte_0[num8] = array2[num8, num7].R;
                                    }
                                }
                                break;

                            default:
                                throw new NotSupportedException("Format not supported: " + format);
                            }
                        }
                        else
                        {
                            array           = new Class486.Class487[bitmap.Height];
                            Color[,] array3 = new Color[bitmap.Width, bitmap.Height];
                            Class486.smethod_5(bitmap, array3);
                            for (int num9 = 0; num9 < bitmap.Height; num9++)
                            {
                                array[num9]        = new Class486.Class487();
                                array[num9].byte_0 = new byte[bitmap.Width];
                                for (int num10 = 0; num10 < bitmap.Width; num10++)
                                {
                                    array[num9].byte_0[num10] = array3[num10, num9].A;
                                }
                            }
                        }
                        foreach (Class486.Class487 tbl in array)
                        {
                            Class486.smethod_7(stream, tbl);
                        }
                        Array.Reverse(array);
                        binaryWriter.Seek(512, SeekOrigin.Begin);
                        foreach (Class486.Class487 class3 in array)
                        {
                            stream.smethod_35(class3.int_0);
                        }
                        foreach (Class486.Class487 class4 in array)
                        {
                            stream.smethod_35(class4.int_1);
                        }
                    }
                }
            }
        }