Ejemplo n.º 1
0
 internal void method_18(string string_1)
 {
     if ((string_1 != null) && !Class198.smethod_4(string_1))
     {
         throw JsonWriterException.smethod_1(this, "Only white space characters should be used.", null);
     }
 }
Ejemplo n.º 2
0
        internal void method_11(JsonToken jsonToken_0)
        {
            State state = state_0[(int)jsonToken_0][(int)this.state_2];

            if (state == State.Error)
            {
                throw JsonWriterException.smethod_1(this, "Token {0} in state {1} would result in an invalid JSON object.".smethod_1(CultureInfo.InvariantCulture, jsonToken_0.ToString(), this.state_2.ToString()), null);
            }
            if ((((this.state_2 == State.Object) || (this.state_2 == State.Array)) || (this.state_2 == State.Constructor)) && (jsonToken_0 != JsonToken.Comment))
            {
                this.WriteValueDelimiter();
            }
            if (this.formatting_0 == Newtonsoft.Json.Formatting.Indented)
            {
                if (this.state_2 == State.Property)
                {
                    this.WriteIndentSpace();
                }
                if (((this.state_2 == State.Array) || (this.state_2 == State.ArrayStart)) || (((this.state_2 == State.Constructor) || (this.state_2 == State.ConstructorStart)) || ((jsonToken_0 == JsonToken.PropertyName) && (this.state_2 != State.Start))))
                {
                    this.WriteIndent();
                }
            }
            this.state_2 = state;
        }
Ejemplo n.º 3
0
        private JsonToken method_9(Enum12 enum12_0)
        {
            switch (enum12_0)
            {
            case Enum12.Object:
                return(JsonToken.EndObject);

            case Enum12.Array:
                return(JsonToken.EndArray);

            case Enum12.Constructor:
                return(JsonToken.EndConstructor);
            }
            throw JsonWriterException.smethod_1(this, "No close token for type: " + enum12_0, null);
        }
Ejemplo n.º 4
0
        private void method_7(Enum12 enum12_0)
        {
            switch (enum12_0)
            {
            case Enum12.Object:
                this.WriteEndObject();
                return;

            case Enum12.Array:
                this.WriteEndArray();
                return;

            case Enum12.Constructor:
                this.WriteEndConstructor();
                return;
            }
            throw JsonWriterException.smethod_1(this, "Unexpected type when writing end: " + enum12_0, null);
        }
Ejemplo n.º 5
0
        protected override void WriteEnd(JsonToken token)
        {
            switch (token)
            {
            case JsonToken.EndObject:
                this.textWriter_0.Write("}");
                return;

            case JsonToken.EndArray:
                this.textWriter_0.Write("]");
                return;

            case JsonToken.EndConstructor:
                this.textWriter_0.Write(")");
                return;
            }
            throw JsonWriterException.smethod_1(this, "Invalid JsonToken: " + token, null);
        }
Ejemplo n.º 6
0
        private void method_6(JsonReader jsonReader_0)
        {
            if (!jsonReader_0.Read())
            {
                throw JsonWriterException.smethod_1(this, "Unexpected end when reading date constructor.", null);
            }
            if (jsonReader_0.JsonToken_0 != JsonToken.Integer)
            {
                throw JsonWriterException.smethod_1(this, "Unexpected token when reading date constructor. Expected Integer, got " + jsonReader_0.JsonToken_0, null);
            }
            long     num  = (long)jsonReader_0.Object_0;
            DateTime time = Class184.smethod_11(num);

            if (!jsonReader_0.Read())
            {
                throw JsonWriterException.smethod_1(this, "Unexpected end when reading date constructor.", null);
            }
            if (jsonReader_0.JsonToken_0 != JsonToken.EndConstructor)
            {
                throw JsonWriterException.smethod_1(this, "Unexpected token when reading date constructor. Expected EndConstructor, got " + jsonReader_0.JsonToken_0, null);
            }
            this.WriteValue(time);
        }
Ejemplo n.º 7
0
 private static JsonWriterException smethod_4(JsonWriter jsonWriter_0, object object_0)
 {
     return(JsonWriterException.smethod_1(jsonWriter_0, "Unsupported type: {0}. Use the JsonSerializer class to get the object's JSON representation.".smethod_0(CultureInfo.InvariantCulture, object_0.GetType()), null));
 }
Ejemplo n.º 8
0
        private void method_10(Enum12 enum12_0)
        {
            int num = 0;

            if (this.struct25_0.enum12_0 == enum12_0)
            {
                num = 1;
            }
            else
            {
                int num2 = this.Top - 2;
                for (int j = num2; j >= 0; j--)
                {
                    int num4 = num2 - j;
                    if (this.list_0[num4].enum12_0 == enum12_0)
                    {
                        num = j + 2;
                        break;
                    }
                }
            }
            if (num == 0)
            {
                throw JsonWriterException.smethod_1(this, "No token to close.", null);
            }
            for (int i = 0; i < num; i++)
            {
                JsonToken token = this.method_9(this.method_2());
                if (this.state_2 == State.Property)
                {
                    this.WriteNull();
                }
                if (((this.formatting_0 == Newtonsoft.Json.Formatting.Indented) && (this.state_2 != State.ObjectStart)) && (this.state_2 != State.ArrayStart))
                {
                    this.WriteIndent();
                }
                this.WriteEnd(token);
                Enum12 enum2 = this.method_3();
                switch (enum2)
                {
                case Enum12.None:
                    this.state_2 = State.Start;
                    break;

                case Enum12.Object:
                    this.state_2 = State.Object;
                    break;

                case Enum12.Array:
                    this.state_2 = State.Array;
                    break;

                case Enum12.Constructor:
                    this.state_2 = State.Array;
                    break;

                default:
                    throw JsonWriterException.smethod_1(this, "Unknown JsonType: " + enum2, null);
                }
            }
        }