public EfkPkgImporter(EfkPkg efkpkg, string defaultDestinationPath) { resourceRoots.Add(new ResourceRoot(FileType.Effect) { RootPath = "Effects/" }); resourceRoots.Add(new ResourceRoot(FileType.Texture) { RootPath = "Textures/" }); resourceRoots.Add(new ResourceRoot(FileType.Model) { RootPath = "Models/" }); resourceRoots.Add(new ResourceRoot(FileType.Material) { RootPath = "Materials/" }); resourceRoots.Add(new ResourceRoot(FileType.Sound) { RootPath = "Sounds/" }); resourceRoots.Add(new ResourceRoot(FileType.Curve) { RootPath = "Curves/" }); DestinationPath = defaultDestinationPath; this.efkpkg = efkpkg; if (DestinationPath == null) { DestinationPath = Directory.GetCurrentDirectory(); } DestinationPath = Misc.BackSlashToSlash(DestinationPath); foreach (var file in efkpkg.AllFiles) { var import = new ImportFile(this, file); import.DestinationRelativePath = file.RelativePath; import.DoesImport = true; importedFiles.Add(import); } RenewIOStatus(); }
Dictionary <string, string> GetRelatedFilePathToHashes() { var pathToHashes = new Dictionary <string, string>(); foreach (var imported in importedFiles) { var path = imported.GetDestinationPath(DestinationPath, resourceRoots, resourceDestinationType); var dirPath = Path.GetDirectoryName(path); var files = new string[0]; if (Directory.Exists(dirPath)) { files = Directory.GetFiles(dirPath).Select(_ => Misc.BackSlashToSlash(_)).ToArray(); } foreach (var f in files) { if (pathToHashes.ContainsKey(f)) { continue; } try { var hash = EfkPkg.ComputeHashName(File.ReadAllBytes(f)); pathToHashes.Add(f, hash); } catch { } } } return(pathToHashes); }