Example #1
0
        public static Stream OpenVisualFile(string modelFile, IFileLocator fileLocator)
        {
            var    visualFile = Path.ChangeExtension(modelFile, ".visual"); // pre 10.0
            Stream stream;

            if (fileLocator.TryOpenRead(visualFile, out stream))
            {
                return(stream);
            }

            visualFile = Path.ChangeExtension(modelFile, ".visual_processed"); // post 10.0
            return(fileLocator.OpenRead(visualFile));
        }
Example #2
0
        public static Stream OpenPrimitiveFile(string modelFile, IFileLocator fileLocator)
        {
            var primitiveFile = Path.ChangeExtension(modelFile, ".primitives"); // pre 10.0

            Stream stream;

            if (fileLocator.TryOpenRead(primitiveFile, out stream))
            {
                return(stream);
            }

            primitiveFile = Path.ChangeExtension(modelFile, ".primitives_processed"); // post 10.0
            return(fileLocator.OpenRead(primitiveFile));
        }
        private static Stream OpenTexture(IFileLocator fileLocator, string path)
        {
            Stream stream;

            if (fileLocator.TryOpenRead(path, out stream))
            {
                return(stream);
            }

            if (Path.GetExtension(path) == ".tga")
            {
                path = Path.ChangeExtension(path, ".dds");
                return(fileLocator.OpenRead(path));
            }

            throw new FileNotFoundException("file not found", path);
        }