/// <summary> /// /// </summary> /// <param name="obj"></param> /// <param name="binaryWriter"></param> /// <param name="translationContext"></param> public override void Serialize(object obj, BinaryWriter binaryWriter, TranslationContext translationContext) { translationContext.ResolveGraph(obj); ClassDescriptor rootObjectClassDescriptor = ClassDescriptor.GetClassDescriptor(obj.GetType()); try { Serialize(obj, rootObjectClassDescriptor.PseudoFieldDescriptor, binaryWriter, translationContext); } catch (Exception ex) { throw new SimplTranslationException("IO exception occured: ", ex); } }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <param name="textWriter"></param> /// <param name="translationContext"></param> public override void Serialize(object obj, TextWriter textWriter, TranslationContext translationContext) { translationContext.ResolveGraph(obj); ClassDescriptor rootObjectClassDescriptor = ClassDescriptor.GetClassDescriptor(obj.GetType()); try { WriteStart(textWriter); Serialize(obj, rootObjectClassDescriptor.PseudoFieldDescriptor, textWriter, translationContext, true); WriteClose(textWriter); } catch (Exception ex) { throw new SimplTranslationException("IO exception occured: ", ex); } }