public static List <Mesh> LoadFromFile(string meshFilename) #endif { List <Mesh> loadedMeshes = new List <Mesh>(); // open the mesh file Stream fs = null; try { #if NETFX_CORE if (!Path.IsPathRooted(meshFilename)) { meshFilename = Path.Combine(Windows.ApplicationModel.Package.Current.InstalledLocation.Path, meshFilename); } StorageFile file = await Windows.Storage.StorageFile.GetFileFromPathAsync(meshFilename); using (fs = await file.OpenStreamForReadAsync()) #else using (fs = File.OpenRead(meshFilename)) #endif using (BinaryReader br = new BinaryReader(fs)) { // Read how many meshes are in the scene var meshCount = br.ReadUInt32(); for (var i = 0; i < meshCount; i++) { // Load the mesh Mesh mesh = Mesh.Load(br); if (mesh != null) { loadedMeshes.Add(mesh); } } } } catch (Exception e) { Debug.WriteLine("Unable to load mesh file '" + meshFilename + "': " + e.ToString()); } return(loadedMeshes); }