public ITuning Add(string name, FullNote[] rootNotes) { if (ReadOnly) { throw new ObjectIsReadOnlyException(this); } Tuning tuning = new Tuning(this, name, rootNotes); Add(tuning); return(tuning); }
public int CompareTo(object obj) { if (null == obj) { throw new ArgumentNullException(nameof(obj)); } Tuning tuning = obj as Tuning; if (null == tuning) { throw new ArgumentException(); } return(LongName.CompareTo(tuning.LongName)); }
public void Read(XmlReader xmlReader) { if (null == xmlReader) { throw new ArgumentNullException(nameof(xmlReader)); } using (xmlReader) { do { if (xmlReader.IsStartElement() && xmlReader.Name == "tuning") { Tuning tuning = new Tuning(this, xmlReader.ReadSubtree()); Add(tuning); } } while (xmlReader.Read()); } }
internal void Resort(Tuning tuning, Action rollback) { if (Remove(tuning)) { try { Add(tuning); } catch (Exception ex) { if (null != rollback) { rollback(); // Re-add since remove succeeded but re-add failed if (null != (ex as TuningAlreadyExistsException)) { Add(tuning); } } throw; } } }