public static void SaveObject <TType>(TType instance, Stream output, bool isClient, bool isServer, Func <string, int> getIndexFromFileName) where TType : Serialization.IStructure, new() { using (var data = new MemoryStream()) { var reader = new BlobDataWriter(data, isClient, isServer, getIndexFromFileName); reader.WriteValueStructure(instance, false, null); data.Position = 0; output.WriteFromStream(data, data.Length); } }
public static void SaveResource <TType>(List <TType> list, Stream output, bool isClient, bool isServer, Func <string, int> getIndexFromFileName) where TType : Serialization.IStructure, new() { var loader = new ResourceLoader <TType>(); loader.List.AddRange(list); using (var data = new MemoryStream()) { var reader = new BlobDataWriter(data, isClient, isServer, getIndexFromFileName); reader.WriteValueStructure(loader, false, null); data.Position = 0; output.WriteFromStream(data, data.Length); } }