public void read(List <string> fileList)
        {
            progressions.Clear();
            foreach (string fileName in fileList)
            {
                StreamReader sr        = new StreamReader(ChordProgressionDatabase.folder + fileName);
                char[]       separater = new char[] { ' ', ',', '\t', '|' };
                int          lineCount = 1;
                while (!sr.EndOfStream)
                {
                    string[]         progressionString = sr.ReadLine().Split(separater).Where(p => p.Length > 0).ToArray();
                    ChordProgression progression       = new List <Chord>();
                    foreach (string str in progressionString)
                    {
                        var chord = Chord.createChordFromChordName(str);
                        if (chord != null)
                        {
                            if (!ignoreSlashChord)
                            {
                                progression.Add(chord);
                            }
                            else
                            {
                                if (MainWindow.hasHarmony(chord.harmony))
                                {
                                    progression.Add(chord);
                                }
                                else
                                {
                                    chord.harmony.baseNote = 0;
                                    chord.harmony.uniqueIdRecalculation();
                                    progression.Add(chord);
                                }
                            }
                        }
                        else
                        {
                            MainWindow.Write("***Warning*** " + str + " (@" + fileName + ":line" + lineCount.ToString() + ")is skipped\n");
                        }
                    }
                    lineCount++;
                    if (progression.Count > 0)
                    {
                        progressions.Add(progression);
                    }
                }
            }

            defaultWeight = new double[ChordBasic.toneCount, MainWindow.harmonyCount];
            suggestWeight = new double[ChordBasic.toneCount, MainWindow.harmonyCount];
            int sum = 0;

            foreach (ChordProgression cp in progressions)
            {
                sum += cp.Count;
                foreach (Chord chord in cp)
                {
                    if (MainWindow.hasHarmony(chord.harmony))
                    {
                        defaultWeight[chord.root.id, MainWindow.getPadHarmonyId(chord.harmony)] += 1.0;
                    }
                }
            }
            weightBalancing(ref defaultWeight);
            MainWindow.Write("\t" + progressions.Count.ToString() + " chord progressions with " + sum.ToString() + " chords loaded\n");
        }
        private void convertProgression()
        {
            int    transposeKey = 0;
            string str          = TextBox_ForConvert.Text;

            str = removeTags(str);
            string[]             lines             = str.Split('\n');
            List <List <Chord> > chordProgressions = new List <List <Chord> >();

            for (int i = 0; i < lines.Length; i++)
            {
                string       line        = lines[i];
                string[]     del         = { "|", " ", "\t", "\r" };
                string[]     items       = line.Split(del, StringSplitOptions.RemoveEmptyEntries);
                string       lastItem    = "";
                List <Chord> progression = new List <Chord>();
                for (int j = 0; j < items.Length; j++)
                {
                    string item = items[j];
                    if (item == "%")
                    {
                        item = lastItem;
                    }
                    if (item.Contains("key") || item.Contains("Key"))
                    {
                        var matchKeys = ChordBasic.toneList.FindAll(m => item.Contains(m.name) || (m.subname.Length > 0 && item.Contains(m.subname)));
                        if (matchKeys.Count > 0)
                        {
                            int cur    = 0;
                            int maxlen = 0;
                            for (int key = 0; key < matchKeys.Count; key++)
                            {
                                if (item.Contains(matchKeys[key].name))
                                {
                                    if (maxlen < matchKeys[key].name.Length)
                                    {
                                        maxlen = matchKeys[key].name.Length;
                                        cur    = key;
                                    }
                                }
                                if (item.Contains(matchKeys[key].subname))
                                {
                                    if (maxlen < matchKeys[key].subname.Length)
                                    {
                                        maxlen = matchKeys[key].subname.Length;
                                        cur    = key;
                                    }
                                }
                            }

                            transposeKey = matchKeys[cur].id;
                            ConvertWrite("Transpose to " + matchKeys[cur].name + " with " + item + "\n");
                        }
                    }
                    else
                    {
                        var res = Chord.createChordFromChordName(item);
                        if (res == null)
                        {
                            ConvertWrite(item + " cannot translate\n");
                        }
                        else
                        {
                            res.transpose((ChordBasic.toneCount - transposeKey) % ChordBasic.toneCount);
                            progression.Add(res);
                        }
                    }
                    lastItem = item;
                }
                if (progression.Count > 0)
                {
                    chordProgressions.Add(progression);
                }
            }
            ConvertWrite("Text converted\n");

            string resultString = "";

            for (int i = 0; i < chordProgressions.Count; i++)
            {
                for (int j = 0; j < chordProgressions[i].Count; j++)
                {
                    resultString += chordProgressions[i][j].ToString();
                    if (j + 1 != chordProgressions[i].Count)
                    {
                        resultString += "\t";
                    }
                }
                resultString += "\n";
            }
            TextBox_Converted.Text = resultString;
        }