private List <PREH> GetPresetLocales(ListBox.SelectedIndexCollection indeces) { var list = new List <PREH>(); if (0 == lstPreset.Items.Count) { return(list); } if (indeces.Count < 0) { return(list); } foreach (int index in indeces) { var cols = lstPreset.Items[index].ToString().Split('|'); var locale = new PREH(); locale.IsDrum = "Drum" == cols[0]; locale.ProgNum = byte.Parse(cols[1]); locale.BankMSB = byte.Parse(cols[2]); locale.BankLSB = byte.Parse(cols[3]); list.Add(locale); } return(list); }
private void btnAdd_Click(object sender, EventArgs e) { var id = new PREH { ProgNum = (byte)lstPrgNo.SelectedIndex, BankMSB = (byte)lstBankMSB.SelectedIndex, BankLSB = (byte)lstBankLSB.SelectedIndex, IsDrum = rbDrum.Checked }; if (mFile.Preset.ContainsKey(id)) { MessageBox.Show("既に同じ識別子の音色が存在します。"); return; } var preset = new Preset(); preset.Header = id; preset.Info.Name = txtInstName.Text; preset.Info.Category = cmbCategory.Text; if (null != mPreset) { mPreset.Header = id; mPreset.Info.Name = preset.Info.Name; mPreset.Info.Category = preset.Info.Category; preset = mPreset; } mFile.Preset.Add(id, preset); Close(); }
private PREH GetPresetLocale(int index) { if (0 == lstPreset.Items.Count) { return(new PREH()); } if (index < 0) { return(new PREH()); } var cols = lstPreset.Items[index].ToString().Split('|'); var locale = new PREH(); locale.IsDrum = "Drum" == cols[0]; locale.ProgNum = byte.Parse(cols[1]); locale.BankMSB = byte.Parse(cols[2]); locale.BankLSB = byte.Parse(cols[3]); return(locale); }