packages/Windows API Code Pack 1.1/source/Samples/DirectX/CS/UtilitiesLibrary/MeshLoader/XMeshLoader.cs
/// <summary>
/// Loads the mesh from the file
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
Loads the mesh from the file
Loads the mesh from the file
public IEnumerable<Part> XMeshFromFile(string path)
        {
            string meshPath = null;
            if(File.Exists(path))
            {
                meshPath = path;
            }
            else
            {
                string sdkMediaPath = GetDXSDKMediaPath() + path;
                if (File.Exists(sdkMediaPath))
                    meshPath = sdkMediaPath;
            }
            if(meshPath == null)
                throw new System.IO.FileNotFoundException("Could not find mesh file.");
            else
                meshDirectory = Path.GetDirectoryName(meshPath);
            string data = null;
            using (StreamReader xFile = File.OpenText(meshPath))
            {
                string header = xFile.ReadLine();
                ValidateHeader(header);
                data = xFile.ReadToEnd();
            }
            return ExtractRootParts(data);
        }
public IEnumerable < Part > XMeshFromFile ( string path ) { string meshPath = null ; if ( File . Exists ( path ) ) { meshPath = path ; } else { string sdkMediaPath = GetDXSDKMediaPath ( ) + path ; if ( File . Exists ( sdkMediaPath ) ) meshPath = sdkMediaPath ; } if ( meshPath == null ) throw new System . IO . FileNotFoundException ( " " ) ; else meshDirectory = Path . GetDirectoryName ( meshPath ) ; string data = null ; using ( StreamReader xFile = File . OpenText ( meshPath ) ) { string header = xFile . ReadLine ( ) ; ValidateHeader ( header ) ; data = xFile . ReadToEnd ( ) ; } return ExtractRootParts ( data ) ; }
Loads the mesh from the file
Loads the mesh from the file
None
path
string
None