Exemple #1
0
 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);
     }
 }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
 public static void Write(this ITreeWriter writer, string name, ITreeSerializable value)
 {
     if (value != null)
     {
         writer.WritePropertyName(name);
         value.Write(writer);
     }
 }
Exemple #4
0
 // 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);
     }
 }
Exemple #5
0
 public static void Load(this ITreeSerializable item, string filePath, TreeFormat format, TreeSerializationSettings settings = null)
 {
     Load(item, File.OpenRead(filePath), format, settings);
 }
Exemple #6
0
 public static void Save(this ITreeSerializable item, string filePath, TreeFormat format, TreeSerializationSettings settings = null)
 {
     Save(item, File.Create(filePath), format, settings);
 }