public PresetExportInfo(Preset preset) { PluginName = preset.Plugin.GetEffectivePluginName(); PluginVendor = preset.Plugin.PluginVendor; PluginId = preset.Plugin.VstPluginId; PluginType = preset.Plugin.PluginType; PresetGuid = Guid.Parse(preset.PresetId); if (preset.PresetBank == null) { throw new ArgumentException( $"PresetExportInfo: PresetBank for preset {preset.Metadata.PresetName} (SourceFile " + $"{preset.OriginalMetadata.SourceFile}) is null. Please report this as a bug!"); } BankPath = preset.PresetBank.GetBankPath().ToList(); BankPath.RemoveFirst(); BankName = preset.PresetBank.BankName; PresetName = preset.Metadata.PresetName; PreviewNotePlayer = preset.PreviewNotePlayer; DefaultControllerAssignments = preset.Plugin.DefaultControllerAssignments; Author = preset.Metadata.Author; Comment = preset.Metadata.Comment; foreach (var type in preset.Metadata.Types) { if (!type.IsIgnored) { Types.Add(new List <string> { type.EffectiveTypeName, type.EffectiveSubTypeName }); } } foreach (var mode in preset.Metadata.Characteristics) { if (!mode.IsIgnored) { Modes.Add(mode.EffectiveCharacteristicName); } } }
private List <string> GetBankPath() { switch (FolderMode) { case FolderExportMode.SINGLE_FOLDER: return(new List <string>()); case FolderExportMode.ONE_LEVEL_LAST_BANK: return(new List <string> { BankPath.Last() }); case FolderExportMode.ONE_LEVEL_FIRST_BANK: return(new List <string> { BankPath.First() }); case FolderExportMode.SUBFOLDERS_TRIMMED: var bp = new List <string>(BankPath.ToList()); if (bp.Count > 1) { var d = BankPath.GetRange(1, BankPath.Count - 1); var lastBankPath = string.Join(" - ", d); bp.RemoveRange(1, BankPath.Count - 1); bp.Add(lastBankPath); } return(bp); case FolderExportMode.SUBFOLDERS: return(BankPath.ToList()); } return(null); }