예제 #1
0
        public void ConvertModels(string inputDirectoryPath, string outputDirectoryPath, Exporter exporter)
        {
            string outputExtension = exporter.Options.OutputFormat.ToString().ToLower();

            ProgressUpdate("Enumerating files ...", 0, 1);
            List <string> inputFilePaths = EnumerateFiles(inputDirectoryPath, exporter.Options.InputFormat);

            ProgressUpdate("Converting resources ...", 0, 1);
            for (var i = 0; i < inputFilePaths.Count; i++)
            {
                string inputFilePath = inputFilePaths[i];

                string outputFilePath = Path.ChangeExtension(inputFilePath.Replace(inputDirectoryPath, outputDirectoryPath), outputExtension);

                FileManager.TryToCreateDirectory(outputFilePath);

                ProgressUpdate($"Converting: {inputFilePath}", i, inputFilePaths.Count);
                try
                {
                    Root model = LoadModel(inputFilePath, exporter.Options);
                    SaveModel(model, outputFilePath, exporter);
                }
                catch (Exception exc)
                {
                    ConversionError(inputFilePath, outputFilePath, exc);
                }
            }
        }
예제 #2
0
        public void ConvertResources(string inputDir, string outputDir, ResourceFormat inputFormat, ResourceFormat outputFormat, FileVersion outputVersion = 0x0)
        {
            this.progressUpdate("Enumerating files ...", 0, 1);
            var paths = new List <string>();

            EnumerateFiles(paths, inputDir, inputDir, "." + inputFormat.ToString().ToLower());

            this.progressUpdate("Converting resources ...", 0, 1);
            for (var i = 0; i < paths.Count; i++)
            {
                var path    = paths[i];
                var inPath  = inputDir + "/" + path;
                var outPath = outputDir + "/" + Path.ChangeExtension(path, outputFormat.ToString().ToLower());

                FileManager.TryToCreateDirectory(outPath);

                this.progressUpdate("Converting: " + inPath, i, paths.Count);
                var resource = LoadResource(inPath, inputFormat);
                SaveResource(resource, outPath, outputFormat, outputVersion);
            }
        }