Пример #1
0
 /// <summary>
 /// Loads a Model from a file, generating a hash in the process.
 /// The hash is used to determine whether the Model has unsaved changes.
 /// </summary>
 /// <typeparam name="T">The type of the root object in the Model.</typeparam>
 /// <param name="path">The full path from which to load the Model.</param>
 /// <returns>The deserialized Model.</returns>
 protected internal static T Load <T> (string path) where T : ModelRoot
 {
     using (FileStream fileStream = File.OpenRead(path))
     {
         T model = ModelRoot.Load <T> (fileStream, path);
         return(model);
     }
 }
Пример #2
0
 /// <summary>
 /// Loads a model from a stream, generating a hash in the process.
 /// The hash is used to determine whether the Model has unsaved changes.
 /// </summary>
 /// <typeparam name="T">The type of the root object in the Model.</typeparam>
 /// <param name="stream">The stream from which to load the Model.</param>
 /// <returns>The deserialized Model.</returns>
 protected internal static T Load <T> (Stream stream) where T : ModelRoot
 {
     return(ModelRoot.Load <T> (stream, null));
 }