public void Write(IFormatWriter writer, object instance) { var value = _serializer.Access.Get(instance); var content = _converter.Format(value); writer.Content(content); }
public void Write(IFormatWriter writer, RootClass instance) { System.Xml.XmlWriter native = writer.Get().AsValid <System.Xml.XmlWriter>(); // if you need it. writer.Content(_name, instance.ManyToOneReference.Name); _serializer.Write(writer, instance); }
public void Write(IFormatWriter writer, RomBytes instance) { var options = new List <string> { $"version:{CurrentDataFormatVersion}", }; var romByteEncoding = new RomByteEncoding(); var lines = new List <string>(); foreach (var rb in instance) { var encodedTxt = romByteEncoding.EncodeByte(rb); lines.Add(encodedTxt); // debug check, optional: #if EXTRA_DEBUG_CHECKS var decoded = romByteEncoding.DecodeRomByte(encodedTxt); Debug.Assert(decoded.EqualsButNoRomByte(rb)); #endif } if (CompressGroupBlock) { options.Add("compress_groupblocks"); RepeaterCompression.Compress(ref lines); } if (CompressUsingTable1) { options.Add("compress_table_1"); SubstitutionCompression.EncodeCompression_Table1(ref lines); } writer.Content($"\n{string.Join(",", options)}\n"); foreach (var line in lines) { writer.Content(line + "\n"); } }
public void Write(IFormatWriter writer, object instance) { var type = instance?.GetType(); if (type != null) { if (_type.IsSatisfiedBy(type)) { _property.Write(writer, type.GetTypeInfo()); _runtime.Write(writer, instance); } else { _body.Write(writer, instance); } } else { writer.Content(null); } }
public void Write(IFormatWriter writer, T instance) => writer.Content(_identity, _formatter(writer, instance));
public void Write(IFormatWriter writer, IInterface instance) { writer.Content(instance.GetType().AssemblyQualifiedName); }
public void Write(IFormatWriter writer, string instance) { writer.Content($"Hello World! {instance}"); }
public void Write(IFormatWriter writer, MemberInfo instance) => writer.Content(writer.Get(instance));
public void Write(IFormatWriter writer, string instance) { writer.Content($"The registered encoding is: {_encoding.WebName}"); }
public void Content(IIdentity property, string content) { _writer.Content(property, content); }
public void Write(IFormatWriter writer, DateTime instance) { writer.Content(_converter.Format(instance)); }
public void Content(IIdentity identity, string content) => _writer.Content(identity, content);
public void Write(IFormatWriter writer, Subject instance) { writer.Content($"{instance.Text}|{instance.Number}"); }
public void Write(IFormatWriter writer, RootClass instance) { writer.Content(_name, instance.ManyToOneReference.Name); _serializer.Write(writer, instance); }