Exemple #1
0
        public static void Read(object obj, Writer writer, ObjectParsingOptions options = null)
        {
            ObjectReader reader = new ObjectReader(writer, options ?? new ObjectParsingOptions());

            try
            {
                reader.Read(obj);
            }
            catch (Exception e)
            {
                throw new ObjectReadException(reader, e);
            }
        }
 public virtual void Read(object value, ObjectReader reader, Writer writer)
 {
     InnerDefinition.Read(value, reader, writer);
 }
 public void Read(object value, ObjectReader reader, Writer writer)
 {
     TypeDef.ReadObject(value, reader, writer, PartialOptions.Default);
 }
Exemple #4
0
 private static string BuildMessage(ObjectReader reader, Exception innerException)
 {
     string propertyStack = reader.PropertyStack
         .Select(p => p.FullName)
         .Join(Environment.NewLine);
     return "{1}{0}At: {2}".FormatWith(Environment.NewLine, innerException.Message, propertyStack);
 }
Exemple #5
0
 public ObjectReadException(ObjectReader reader, Exception innerException)
     : base(BuildMessage(reader, innerException), innerException)
 {
 }
Exemple #6
0
 public void ReadObject(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
 {
     if (input == null)
         writer.WriteNull();
     else if (isSealed || input.GetType() == Type)
         Read(input, reader, writer, optionsOverride);
     else
     {
         TypeDefinition inputTypeDef = TypeCache.GetTypeDefinition(input);
         optionsOverride.SerializeTypeInformation = TypeInformationLevel.Minimal;
         inputTypeDef.Read(input, reader, writer, optionsOverride);
     }
 }
Exemple #7
0
 public abstract void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride);