Exemplo n.º 1
0
        protected bool method_2(object object_0, JsonContract jsonContract_0, object object_1, IJsonLineInfo ijsonLineInfo_0, string string_0, Exception exception_0)
        {
            ErrorContext context = this.method_0(object_0, object_1, string_0, exception_0);

            if (((this.itraceWriter_0 != null) && (this.itraceWriter_0.LevelFilter >= TraceLevel.Error)) && !context.Boolean_0)
            {
                context.Boolean_0 = true;
                string str = this.bool_0 ? "Error serializing" : "Error deserializing";
                if (jsonContract_0 != null)
                {
                    str = str + " " + jsonContract_0.UnderlyingType;
                }
                str = str + ". " + exception_0.Message;
                if (!(exception_0 is JsonException))
                {
                    str = Struct25.smethod_2(ijsonLineInfo_0, string_0, str);
                }
                this.itraceWriter_0.Trace(TraceLevel.Error, str, exception_0);
            }
            if (jsonContract_0 != null)
            {
                jsonContract_0.method_4(object_0, this.jsonSerializer_0.StreamingContext_0, context);
            }
            if (!context.Handled)
            {
                this.jsonSerializer_0.method_3(new ErrorEventArgs(object_0, context));
            }
            return(context.Handled);
        }
Exemplo n.º 2
0
 private void method_16(JsonWriter jsonWriter_0, JsonContract jsonContract_1, object object_0)
 {
     if ((base.itraceWriter_0 != null) && (base.itraceWriter_0.LevelFilter >= TraceLevel.Info))
     {
         base.itraceWriter_0.Trace(TraceLevel.Info, Struct25.smethod_2(null, jsonWriter_0.Path, "Finished serializing {0}".smethod_0(CultureInfo.InvariantCulture, jsonContract_1.UnderlyingType)), null);
     }
     jsonContract_1.method_1(object_0, base.jsonSerializer_0.streamingContext_0);
 }
Exemplo n.º 3
0
        private void method_21(JsonWriter jsonWriter_0, Type type_0)
        {
            string str = Class194.smethod_4(type_0, base.jsonSerializer_0.formatterAssemblyStyle_0, base.jsonSerializer_0.serializationBinder_0);

            if ((base.itraceWriter_0 != null) && (base.itraceWriter_0.LevelFilter >= TraceLevel.Verbose))
            {
                base.itraceWriter_0.Trace(TraceLevel.Verbose, Struct25.smethod_2(null, jsonWriter_0.Path, "Writing type name '{0}' for {1}.".smethod_1(CultureInfo.InvariantCulture, str, type_0)), null);
            }
            jsonWriter_0.WritePropertyName("$type", false);
            jsonWriter_0.WriteValue(str);
        }
Exemplo n.º 4
0
        private void method_20(JsonWriter jsonWriter_0, Type type_0, object object_0)
        {
            string str = this.method_13(jsonWriter_0, object_0);

            if ((base.itraceWriter_0 != null) && (base.itraceWriter_0.LevelFilter >= TraceLevel.Verbose))
            {
                base.itraceWriter_0.Trace(TraceLevel.Verbose, Struct25.smethod_2(null, jsonWriter_0.Path, "Writing object reference Id '{0}' for {1}.".smethod_1(CultureInfo.InvariantCulture, str, type_0)), null);
            }
            jsonWriter_0.WritePropertyName("$id", false);
            jsonWriter_0.WriteValue(str);
        }
Exemplo n.º 5
0
        private void method_12(JsonWriter jsonWriter_0, object object_0)
        {
            string str = this.method_13(jsonWriter_0, object_0);

            if ((base.itraceWriter_0 != null) && (base.itraceWriter_0.LevelFilter >= TraceLevel.Info))
            {
                base.itraceWriter_0.Trace(TraceLevel.Info, Struct25.smethod_2(null, jsonWriter_0.Path, "Writing object reference to Id '{0}' for {1}.".smethod_1(CultureInfo.InvariantCulture, str, object_0.GetType())), null);
            }
            jsonWriter_0.WriteStartObject();
            jsonWriter_0.WritePropertyName("$ref", false);
            jsonWriter_0.WriteValue(str);
            jsonWriter_0.WriteEndObject();
        }
Exemplo n.º 6
0
        private bool method_38(JsonWriter jsonWriter_0, JsonProperty jsonProperty_0, object object_0)
        {
            if (jsonProperty_0.GetIsSpecified == null)
            {
                return(true);
            }
            bool flag = jsonProperty_0.GetIsSpecified(object_0);

            if ((base.itraceWriter_0 != null) && (base.itraceWriter_0.LevelFilter >= TraceLevel.Verbose))
            {
                base.itraceWriter_0.Trace(TraceLevel.Verbose, Struct25.smethod_2(null, jsonWriter_0.Path, "IsSpecified result for property '{0}' on {1}: {2}".smethod_2(CultureInfo.InvariantCulture, jsonProperty_0.PropertyName, jsonProperty_0.DeclaringType, flag)), null);
            }
            return(flag);
        }
Exemplo n.º 7
0
        private bool method_11(JsonWriter jsonWriter_0, object object_0, JsonProperty jsonProperty_0, JsonContract jsonContract_1, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_1)
        {
            if (((object_0 != null) && (jsonContract_1.enum15_0 != Enum15.Primitive)) && (jsonContract_1.enum15_0 != Enum15.String))
            {
                ReferenceLoopHandling?referenceLoopHandling = null;
                if (jsonProperty_0 != null)
                {
                    referenceLoopHandling = jsonProperty_0.ReferenceLoopHandling;
                }
                if (!referenceLoopHandling.HasValue && (jsonProperty_1 != null))
                {
                    referenceLoopHandling = jsonProperty_1.ItemReferenceLoopHandling;
                }
                if (!referenceLoopHandling.HasValue && (jsonContainerContract_0 != null))
                {
                    referenceLoopHandling = jsonContainerContract_0.ItemReferenceLoopHandling;
                }
                if (this.list_0.IndexOf(object_0) != -1)
                {
                    string str = "Self referencing loop detected";
                    if (jsonProperty_0 != null)
                    {
                        str = str + " for property '{0}'".smethod_0(CultureInfo.InvariantCulture, jsonProperty_0.PropertyName);
                    }
                    str = str + " with type '{0}'.".smethod_0(CultureInfo.InvariantCulture, object_0.GetType());
                    switch (referenceLoopHandling.GetValueOrDefault(base.jsonSerializer_0.referenceLoopHandling_0))
                    {
                    case ReferenceLoopHandling.Error:
                        throw JsonSerializationException.smethod_3(null, jsonWriter_0.String_0, str, null);

                    case ReferenceLoopHandling.Ignore:
                        if ((base.itraceWriter_0 != null) && (base.itraceWriter_0.LevelFilter >= TraceLevel.Verbose))
                        {
                            base.itraceWriter_0.Trace(TraceLevel.Verbose, Struct25.smethod_2(null, jsonWriter_0.Path, str + ". Skipping serializing self referenced value."), null);
                        }
                        return(false);

                    case ReferenceLoopHandling.Serialize:
                        if ((base.itraceWriter_0 != null) && (base.itraceWriter_0.LevelFilter >= TraceLevel.Verbose))
                        {
                            base.itraceWriter_0.Trace(TraceLevel.Verbose, Struct25.smethod_2(null, jsonWriter_0.Path, str + ". Serializing self referenced value."), null);
                        }
                        return(true);
                    }
                }
            }
            return(true);
        }
Exemplo n.º 8
0
        internal static JsonReaderException smethod_3(IJsonLineInfo ijsonLineInfo_0, string string_0, string string_1, Exception exception_0)
        {
            int lineNumber;
            int linePosition;

            string_1 = Struct25.smethod_2(ijsonLineInfo_0, string_0, string_1);
            if ((ijsonLineInfo_0 != null) && ijsonLineInfo_0.HasLineInfo())
            {
                lineNumber   = ijsonLineInfo_0.LineNumber;
                linePosition = ijsonLineInfo_0.LinePosition;
            }
            else
            {
                lineNumber   = 0;
                linePosition = 0;
            }
            return(new JsonReaderException(string_1, exception_0, string_0, lineNumber, linePosition));
        }
Exemplo n.º 9
0
 private void method_25(JsonWriter jsonWriter_0, JsonConverter jsonConverter_0, object object_0, JsonContract jsonContract_1, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_0)
 {
     if (this.method_9(object_0, null, jsonContract_1, jsonContainerContract_0, jsonProperty_0))
     {
         this.method_12(jsonWriter_0, object_0);
     }
     else if (this.method_11(jsonWriter_0, object_0, null, jsonContract_1, jsonContainerContract_0, jsonProperty_0))
     {
         this.list_0.Add(object_0);
         if ((base.itraceWriter_0 != null) && (base.itraceWriter_0.LevelFilter >= TraceLevel.Info))
         {
             base.itraceWriter_0.Trace(TraceLevel.Info, Struct25.smethod_2(null, jsonWriter_0.Path, "Started serializing {0} with converter {1}.".smethod_1(CultureInfo.InvariantCulture, object_0.GetType(), jsonConverter_0.GetType())), null);
         }
         jsonConverter_0.WriteJson(jsonWriter_0, object_0, this.method_4());
         if ((base.itraceWriter_0 != null) && (base.itraceWriter_0.LevelFilter >= TraceLevel.Info))
         {
             base.itraceWriter_0.Trace(TraceLevel.Info, Struct25.smethod_2(null, jsonWriter_0.Path, "Finished serializing {0} with converter {1}.".smethod_1(CultureInfo.InvariantCulture, object_0.GetType(), jsonConverter_0.GetType())), null);
         }
         this.list_0.RemoveAt(this.list_0.Count - 1);
     }
 }
Exemplo n.º 10
0
 internal static JsonException smethod_0(IJsonLineInfo ijsonLineInfo_0, string string_0, string string_1)
 {
     string_1 = Struct25.smethod_2(ijsonLineInfo_0, string_0, string_1);
     return(new JsonException(string_1));
 }
 internal static JsonSerializationException smethod_3(IJsonLineInfo ijsonLineInfo_0, string string_0, string string_1, Exception exception_0)
 {
     string_1 = Struct25.smethod_2(ijsonLineInfo_0, string_0, string_1);
     return(new JsonSerializationException(string_1, exception_0));
 }
Exemplo n.º 12
0
 internal static JsonWriterException smethod_2(string string_0, string string_1, Exception exception_0)
 {
     string_1 = Struct25.smethod_2(null, string_0, string_1);
     return(new JsonWriterException(string_1, exception_0, string_0));
 }