diff --git a/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/FileSystem/File.cs b/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/FileSystem/File.cs index 00f1ca02..455bb0b0 100644 --- a/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/FileSystem/File.cs +++ b/CSharp/Libraries/UniversalEditor.Essential/ObjectModels/FileSystem/File.cs @@ -185,6 +185,21 @@ namespace UniversalEditor.ObjectModels.FileSystem return om; } + /// + /// Sets the data for this file using the specified and . + /// + /// The type of to save. + /// The specifying how to save the file data. + /// The containing the file data to save. + public void SetObjectModel (DataFormat dataFormat, T objectModel) where T : ObjectModel + { + MemoryAccessor ma = new MemoryAccessor (); + + Document.Save (objectModel, dataFormat, ma); + + byte [] data = ma.ToArray (); + SetData (data); + } public override string ToString() {