public void ExportNKSPreset(PresetExportInfo preset, byte[] data) { var nksf = new NKSFRiff(); nksf.kontaktSound.summaryInformation.summaryInformation.vendor = preset.PluginVendor; nksf.kontaktSound.summaryInformation.summaryInformation.uuid = preset.PresetGuid; nksf.kontaktSound.summaryInformation.summaryInformation.name = preset.PresetName; if (preset.PluginType == Plugin.PluginTypes.Instrument) { nksf.kontaktSound.summaryInformation.summaryInformation.deviceType = "INST"; } else if (preset.PluginType == Plugin.PluginTypes.Effect) { nksf.kontaktSound.summaryInformation.summaryInformation.deviceType = "FX"; } else { throw new ArgumentException("Unknown device type"); } nksf.kontaktSound.summaryInformation.summaryInformation.bankChain.Add(preset.PluginName); nksf.kontaktSound.summaryInformation.summaryInformation.bankChain.AddRange(preset.BankPath); nksf.kontaktSound.summaryInformation.summaryInformation.Types = preset.Types; nksf.kontaktSound.summaryInformation.summaryInformation.Modes = preset.Modes; nksf.kontaktSound.summaryInformation.summaryInformation.author = preset.Author; nksf.kontaktSound.summaryInformation.summaryInformation.comment = preset.Comment + Environment.NewLine + "Generated with PresetMagician"; nksf.kontaktSound.pluginId.pluginId.VSTMagic = (uint)preset.PluginId; nksf.kontaktSound.pluginChunk.PresetData = data; if (preset.DefaultControllerAssignments != null) { nksf.kontaktSound.controllerAssignments.controllerAssignments = preset.DefaultControllerAssignments; } var outputFilename = preset.GetFullOutputPath(); Directory.CreateDirectory(Path.GetDirectoryName(outputFilename)); var fileStream2 = new FileStream(outputFilename, FileMode.Create); nksf.Write(fileStream2); fileStream2.Close(); }
private string MakeRelative(PresetExportInfo presetExportInfo) { return(presetExportInfo.GetFullOutputPath().Replace(presetExportInfo.UserContentDirectory + @"\", "")); }