public static MultiDawg <TPayload> LoadFrom(Stream stream) { var reader = BuiltinTypeIO.TryGetReader <TPayload>() ?? throw new Exception($"No built in reader found for type {nameof(TPayload)}."); return(LoadFrom(stream, reader)); }
public void SaveTo(Stream stream) { var writer = new BinaryWriter(stream); writer.Write(Signature); writer.Write(Version); Serializer.SaveAsMultiDawg(writer, root, BuiltinTypeIO.GetWriter <TPayload>()); writer.Flush(); // do not close the stream }
static Action <BinaryWriter, TPayload> GetStandardWriter() { return(BuiltinTypeIO.GetWriter <TPayload>()); }
public static Dawg <TPayload> Load(Stream stream, Func <BinaryReader, TPayload> readPayload = null) { return(new(LoadIDawg(stream, readPayload ?? BuiltinTypeIO.GetReader <TPayload>()))); }