Example #1
0
        private static bool ProcessChord(int halfSteps,
                                         bool preferSharps,
                                         string[][] chordSearchData,
                                         Range wordRange,
                                         string wdText,
                                         int keyIndex,
                                         int chordIndex)
        {
            var result          = false;
            var chordResultData = Chords.GetChordResultData(preferSharps);

            if (wdText.Trim().Equals(chordSearchData[keyIndex][chordIndex]))
            {
                var valueToAdd = CalculateAdjustmentValue(halfSteps,
                                                          keyIndex);
                var originalChord = chordSearchData[keyIndex][chordIndex];
                var newChord      = chordResultData[(keyIndex + valueToAdd)][chordIndex];

                ReplaceChord(wordRange,
                             wdText,
                             originalChord,
                             newChord);

                result = true;
            }
            return(result);
        }
Example #2
0
        private static bool ProcessKey(int halfSteps,
                                       bool preferSharps,
                                       bool currentChordIsSharp,
                                       Range wordRange,
                                       string wdText,
                                       int keyIndex)
        {
            var bFound          = false;
            var chordSearchData = Chords.GetChordSearchData(currentChordIsSharp);

            for (int chordIndex = 0; chordIndex < chordSearchData[keyIndex].Length && !bFound; chordIndex++)
            {
                bFound = ProcessChord(halfSteps,
                                      preferSharps,
                                      chordSearchData,
                                      wordRange,
                                      wdText,
                                      keyIndex,
                                      chordIndex);
            }
            return(bFound);
        }