public static void Load(this ITreeSerializable item, Stream stream, TreeFormat format, TreeSerializationSettings settings = null) { using (ITreeReader reader = TreeSerializer.Reader(format, stream, settings)) { item.Read(reader); } }
public static void Save(this ITreeSerializable item, Stream stream, TreeFormat format, TreeSerializationSettings settings = null) { using (ITreeWriter writer = TreeSerializer.Writer(format, stream, settings)) { item.Write(writer); } }
public static void Write(this ITreeWriter writer, string name, ITreeSerializable value) { if (value != null) { writer.WritePropertyName(name); value.Write(writer); } }
// WriteObject supports writing a subcomponent with name and value in one call. public static void WriteObject(this ITreeWriter writer, string name, ITreeSerializable component) { if (component != null) { writer.WritePropertyName(name); component.Write(writer); } }
public static void Load(this ITreeSerializable item, string filePath, TreeFormat format, TreeSerializationSettings settings = null) { Load(item, File.OpenRead(filePath), format, settings); }
public static void Save(this ITreeSerializable item, string filePath, TreeFormat format, TreeSerializationSettings settings = null) { Save(item, File.Create(filePath), format, settings); }