public IChordQuality GetChordQuality() { string longName = Settings[Prefix + "chordquality"]; string level = ChordQualityLevel; if (null != _cachedChordQuality) { if (_cachedChordQuality.LongName == longName && _cachedChordQuality.Level == level) { return(_cachedChordQuality); } _cachedChordQuality = null; } ChordQualitySet qualities = _configFile.ChordQualities; while (null != qualities) { if (qualities.Level == level) { if (qualities.TryGet(longName, out ChordQuality cq)) { _cachedChordQuality = cq; break; } } qualities = qualities.Parent; } return(_cachedChordQuality); }
public void CopyFrom(ChordQualitySet chordQualitySet) { if (null == chordQualitySet) { throw new ArgumentNullException("chordQualitySet"); } foreach (ChordQuality sourceChordQuality in chordQualitySet) { bool found = false; foreach (NamedInterval ni in _namedIntervals) { ChordQuality chordQuality = (ChordQuality)ni; if (sourceChordQuality == chordQuality) { found = true; break; } } // Only add if it wasn't found if (!found) { Add(sourceChordQuality.Name, sourceChordQuality.Abbreviation, sourceChordQuality.Intervals); } } }
public ConfigFile(string level) { Level = level; ChordiousSettings = new ChordiousSettings(level); DiagramStyle = new DiagramStyle(level); Instruments = new InstrumentSet(level); ChordQualities = new ChordQualitySet(level); Scales = new ScaleSet(level); DiagramLibrary = new DiagramLibrary(DiagramStyle); }
internal ChordQuality(ChordQualitySet parent, string name, string abbreviation, int[] intervals) : base(parent) { if (null == parent) { throw new ArgumentNullException("parent"); } Name = name; Abbreviation = abbreviation; Intervals = intervals; UpdateParent = true; }
internal ChordQuality(ChordQualitySet parent, XmlReader xmlReader) : base(parent) { if (null == parent) { throw new ArgumentNullException("parent"); } if (null == xmlReader) { throw new ArgumentNullException("xmlReader"); } using (xmlReader) { if (ReadBase(xmlReader, "quality")) { Abbreviation = xmlReader.GetAttribute("abbv"); } } UpdateParent = true; }
internal ChordQualitySet(ChordQualitySet parent, string level) : base(parent, level) { }