public string GenerateConversionParams(string exportLocation = null, bool silent = true, bool batchFormat = false) { if (exportLocation == null) { exportLocation = String.Format("\"{0}\"", Path.ChangeExtension(Info["Path"], ExportInfo["Extension"])); } string arguments = String.Format("-i {0} -o {1}", Info["PathEscaped"], exportLocation); GetWarnings(); // This won't be necessary once the controls use GetWarnings() on value change if (ExportLoop["Enabled"] == 1) { if (ExportLoop["Start"] > ExportLoop["End"]) { // The loop information is invalid - the file would contain a negative number of samples arguments += " --no-loop"; } else { arguments += String.Format(" -l {0}-{1}", ExportLoop["Start"], ExportLoop["End"]); } } else { arguments += " --no-loop"; } if ((bool)AdvancedExportInfo["Apply"]) { switch (ExportInfo["ExtensionNoDot"]) { case "adx": if ((bool)AdvancedExportInfo["ADX_encrypt"]) { switch (AdvancedExportInfo["ADX_type"]) { case "Linear": case "Fixed": arguments += " --adxtype " + AdvancedExportInfo["ADX_type"]; break; case "Exponential": arguments += " --adxtype Exp"; break; default: break; } if ((bool)AdvancedExportInfo["ADX_keystring_use"]) { if (AdvancedExportInfo.TryGetValue("ADX_keystring", out object keystring)) { arguments += " --keystring " + keystring; } } if ((bool)AdvancedExportInfo["ADX_keycode_use"]) { if (AdvancedExportInfo.TryGetValue("ADX_keycode", out object keycode)) { arguments += " --keycode " + keycode; } } switch (AdvancedExportInfo["ADX_filter"]) { case 0: case 1: case 2: case 3: arguments += " --filter " + AdvancedExportInfo["ADX_filter"]; break; default: break; } switch (AdvancedExportInfo["ADX_version"]) { case 3: case 4: arguments += " --version " + AdvancedExportInfo["ADX_version"]; break; default: break; } } break; case "brstm": switch (AdvancedExportInfo["BRSTM_audioFormat"]) { case "DSP-ADPCM": // If not specified, the file is converted to DSP-ADPCM audio format break; case "16-bit PCM": arguments += " -f pcm16"; break; case "8-bit PCM": arguments += " -f pcm8"; break; default: break; } break; case "hca": switch (AdvancedExportInfo["HCA_audioRadioButtonSelector"]) { case "quality": arguments += " --hcaquality " + AdvancedExportInfo["HCA_audioQuality"]; break; case "bitrate": arguments += " --bitrate " + AdvancedExportInfo["HCA_audioBitrate"]; break; default: break; } if ((bool)AdvancedExportInfo["HCA_limitBitrate"]) { arguments += " --limit-bitrate"; } break; default: break; } } int chcp = 65001; if (!silent) { string commentCharacter = ""; if (batchFormat) { commentCharacter = ":: "; } string warnings = ""; if (Warnings.Count > 0) { foreach (var warning in Warnings) { warnings += String.Format("\r\n{0}[WARNING] {1}", commentCharacter, warning.ToString()); } } else { warnings = null; } string title = FormMethods.GetAppInfo("name") + " (" + FormMethods.GetAppInfo("version") + ")"; if (batchFormat) { arguments = String.Format(":: {0}\r\n:: Original file: {1}\r\n:: The converted file: {2}{3}\r\n\r\n@echo off\r\nchcp {4}>nul\r\nVGAudioCli.exe {5}\r\npause>nul", title, Info["Path"], exportLocation, warnings, chcp, arguments); } else { if (warnings != null) { warnings = String.Format("\r\n{0}", warnings); } arguments += warnings; } } else { if (batchFormat) { arguments = String.Format("@echo off\r\nchcp {0}>nul\r\nVGAudioCli.exe {1}\r\npause>nul", chcp, arguments); } } return(arguments); }
public string[] DumpInformation(Dictionary <string, Dictionary <string, object> > Options) { bool dumpExportInfo = (bool)Options["DumpFileInfo"]["IncludeExportInformation"]; string[] lines; int? exportLoop = ExportLoop["Enabled"]; List <string> lineList = new List <string> { FormMethods.GetAppInfo("name") + " (" + FormMethods.GetAppInfo("version") + ")", "Dumped Info (" + Info["Name"] + ")\r\n", Metadata["Full"] }; if (dumpExportInfo) { lineList.Add("----------\r\n"); lineList.Add("Custom Export Info:"); lineList.Add("Target file: " + ExportInfo["ExtensionNoDot"]); if (exportLoop == 1) { lineList.Add("Loop start: " + ExportLoop["Start"]); lineList.Add("Loop end: " + ExportLoop["End"]); } if ((bool)AdvancedExportInfo["Apply"]) { switch (ExportInfo["ExtensionNoDot"]) { case "adx": if ((bool)AdvancedExportInfo["ADX_encrypt"]) { lineList.Add("Encoding type: " + AdvancedExportInfo["ADX_type"]); if ((bool)AdvancedExportInfo["ADX_keystring_use"]) { lineList.Add("Keystring: " + AdvancedExportInfo["ADX_keystring"]); } if ((bool)AdvancedExportInfo["ADX_keycode_use"]) { lineList.Add("Keycode: " + AdvancedExportInfo["ADX_keycode"]); } if ((bool)AdvancedExportInfo["ADX_filter_use"]) { lineList.Add("Encoding filter: " + AdvancedExportInfo["ADX_filter"]); } if ((bool)AdvancedExportInfo["ADX_version_use"]) { lineList.Add("Header version: " + AdvancedExportInfo["ADX_version"]); } } break; case "brstm": lineList.Add("Audio format: " + AdvancedExportInfo["BRSTM_audioFormat"]); break; case "hca": switch (AdvancedExportInfo["HCA_audioRadioButtonSelector"]) { case "quality": lineList.Add("Audio quality: " + AdvancedExportInfo["HCA_audioQuality"]); break; case "bitrate": lineList.Add("Audio bitrate: " + AdvancedExportInfo["HCA_audioBitrate"]); break; default: break; } break; default: break; } } string conversionCommand = GenerateConversionParams(null, false); if (conversionCommand == null) { conversionCommand = "(unable to generate)"; } else { conversionCommand = "VGAudioCli.exe " + conversionCommand; } lineList.Add("\r\nConversion command:\r\n" + conversionCommand); } lines = lineList.ToArray(); return(lines); }