/// <summary> /// /// </summary> /// <param name="combi"></param> /// <param name="programIds"></param> private void WriteOtherTypeOfCompactListLineToFile(IPatch combi, LinkedList <string> programIds) { var usedPrograms = from timbre in ((Combi)combi).Timbres.TimbresCollection where ShowTimbre(timbre) select timbre.UsedProgram; var unorderedProgramIds = (from program in usedPrograms where ((program != null) && SelectedProgramBanks.Contains(program.Parent)) select program.Id).ToList(); unorderedProgramIds.Sort(); for (var n = 0; n < unorderedProgramIds.Count; n++) { if (n == 0) { programIds.AddLast(unorderedProgramIds[n]); } else if (unorderedProgramIds[n - 1] != unorderedProgramIds[n]) { programIds.AddLast(unorderedProgramIds[n]); } } }
/// <summary> /// Only used when command line arguments are used. /// </summary> private void FilterBanks() { if (FilterProgramBankNames != null) { for (int index = SelectedProgramBanks.Count - 1; index >= 0; index--) { IProgramBank bank = SelectedProgramBanks[index]; if (!FilterProgramBankNames.Contains(bank.Id)) { SelectedProgramBanks.Remove(bank); } } } if (FilterCombiBankNames != null) { for (int index = SelectedCombiBanks.Count - 1; index >= 0; index--) { ICombiBank bank = SelectedCombiBanks[index]; if (!FilterCombiBankNames.Contains(bank.Id)) { SelectedCombiBanks.Remove(bank); } } } }
/// <summary> /// /// </summary> /// <param name="timbre"></param> /// <returns></returns> bool ShowTimbre(ITimbre timbre) { return((!IgnoreMutedOffTimbres || ((timbre.GetParam(ParameterNames.TimbreParameterName.Mute) == null) || (!timbre.GetParam(ParameterNames.TimbreParameterName.Mute).Value) && new List <string> { "Int", "On", "Both" }.Contains(timbre.GetParam(ParameterNames.TimbreParameterName.Status).Value))) && (!IgnoreFirstProgram || ((PcgMemory.ProgramBanks.BankCollection.IndexOf(timbre.UsedProgramBank) != 0) && (timbre.UsedProgramBank.Patches.IndexOf(timbre.UsedProgram) != 0))) && (SelectedProgramBanks.Contains(timbre.UsedProgramBank))); }
/// <summary> /// /// </summary> /// <param name="writer"></param> /// <param name="maxTimbresPerCombi"></param> private void WriteOtherTypeOfListLineToFile(TextWriter writer, int maxTimbresPerCombi) { // Print lines. foreach (var combi in from combiBank in SelectedCombiBanks from combi in combiBank.Patches where combiBank.IsLoaded && combi.UseInList(IgnoreInitCombis, FilterOnText, FilterText, FilterCaseSensitive, ListFilterOnFavorites, false) select combi) { var programIds = new LinkedList <string>(); // For the compact list, sort and make IDs unique. if (ListSubType == SubType.Compact) { WriteOtherTypeOfCompactListLineToFile(combi, programIds); } else { var usedPrograms = ((Combi)combi).Timbres.TimbresCollection.Select( timbre => ShowTimbre(timbre) ? timbre.UsedProgram : null).ToList(); foreach (var program in usedPrograms) { if ((program == null) || !SelectedProgramBanks.Contains(program.Parent)) { // Can only occuring for short sub type list. programIds.AddLast(" "); } else { programIds.AddLast(program.Id); } } } WriteLineToFile(writer, combi, programIds, maxTimbresPerCombi); } }