示例#1
0
        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);
        }
示例#2
0
        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);
                }
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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;
        }
示例#5
0
        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;
        }
示例#6
0
 internal ChordQualitySet(ChordQualitySet parent, string level) : base(parent, level)
 {
 }