public static void GetWwiseFiles(string destinationPath, string wwiseTemplateDir) { var wemDir = Path.Combine(".cache", "Windows", "SFX"); //could be platform dependent like "Mac" or "PS3" var wemPath = Path.Combine(wwiseTemplateDir, wemDir); var wemPathInfo = new DirectoryInfo(wemPath); Console.WriteLine("Wwise '.cache': " + wemPath); if (!wemPathInfo.Exists) { throw new FileNotFoundException("Could not find Wwise template .cache Windows SFX directory" + Environment.NewLine); } var fileExt = ".wem"; if (Selected == OggFile.WwiseVersion.Wwise2010) { fileExt = ".ogg"; } var srcPaths = wemPathInfo.EnumerateFiles("*", SearchOption.TopDirectoryOnly).Where(fi => fi.FullName.ToLower().EndsWith(fileExt)).ToList(); if (!srcPaths.Any()) { throw new Exception("<ERROR> Did not find any converted Wwise audio files ..." + Environment.NewLine); } if (Selected != OggFile.WwiseVersion.Wwise2010 && srcPaths.Count < 2) { throw new Exception("<ERROR> Did not find converted Wwise audio and preview files ..." + Environment.NewLine); } var destPreviewPath = string.Format("{0}_preview.wem", destinationPath.Substring(0, destinationPath.LastIndexOf(".", StringComparison.Ordinal))); foreach (var srcPath in srcPaths) { //fix headers for wwise v2016 wem's if ((int)Selected >= (int)OggFile.WwiseVersion.Wwise2016) { OggFile.DowngradeWemVersion(srcPath.FullName, srcPath.Name.Contains("_preview_") ? destPreviewPath : destinationPath); } else { File.Copy(srcPath.FullName, srcPath.Name.Contains("_preview_") ? destPreviewPath : destinationPath, true); } } }
public static void GetWwiseFiles(string destinationPath, string wwiseTemplateDir) { const string wemDir = @".cache\Windows\SFX"; //could be platform dependent like "Mac" or "PS3" var wemPath = Path.Combine(wwiseTemplateDir, wemDir); var wemPathInfo = new DirectoryInfo(wemPath); Console.WriteLine("Wwise '.cache': " + wemPath); if (!wemPathInfo.Exists) { throw new FileNotFoundException("Could not find Wwise template .cache Windows SFX directory"); } var srcPaths = wemPathInfo.EnumerateFiles("*.wem", SearchOption.AllDirectories).ToArray(); if (srcPaths.Length != 2) { throw new Exception("Did not find converted Wem audio and preview files"); } //var destPreviewPath = Path.Combine(Path.GetDirectoryName(destinationPath), Path.GetFileNameWithoutExtension(destinationPath) + "_preview.wem"); var destPreviewPath = string.Format("{0}_preview.wem", destinationPath.Substring(0, destinationPath.LastIndexOf(".", StringComparison.Ordinal))); foreach (var srcPath in srcPaths) { //fix headers for wwise v2016 wem's if ((int)Selected >= (int)OggFile.WwiseVersion.Wwise2016) { OggFile.DowngradeWemVersion(srcPath.FullName, srcPath.Name.Contains("_preview_") ? destPreviewPath : destinationPath); } else { File.Copy(srcPath.FullName, srcPath.Name.Contains("_preview_") ? destPreviewPath : destinationPath, true); } } }