private void ConvertSvfToGltf(string svfFilePath, string gltfFilePath, bool allowExtractShell, GltfOption options, CancellationToken token) { using (var fc = new FileCleaner()) { #region 抽取外壳 if (allowExtractShell) { var idsFilePath = Path.GetTempFileName(); fc.AddFile(idsFilePath); if (token.IsCancellationRequested) { return; } if (ExtractShell(_ExtractShellCLI, svfFilePath, idsFilePath, token)) { //如果抽壳成功,则从原始模型中把外壳提取出来 var tempFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); FileSystemUtility.CreateDirectory(tempFolder); fc.AddFolder(tempFolder); if (token.IsCancellationRequested) { return; } using (var doc = SvfDocument.LoadFrom(svfFilePath)) { if (token.IsCancellationRequested) { return; } if (doc.Extract(idsFilePath, tempFolder, token)) { svfFilePath = tempFolder; //将 Svf -> glTF 的输入源替换成已经抽壳的模型 } } } } #endregion if (token.IsCancellationRequested) { return; } GltfExtension.ConvertToGltf(svfFilePath, gltfFilePath, options, token); } }