public static void InsertNote(string number, string lyric, Insert insert = Insert.Before) { string newNumber = UpgradeNumber(number, 0, 10, insert: insert); List <string> listNumbers = Numbers.ToList(); int newIndex = listNumbers.IndexOf(number); listNumbers.Insert(newIndex + 1, newNumber); Ust.Numbers = listNumbers.ToArray(); UNote notePrev = uNotes[number]; UNote noteN = notePrev.Copy(); noteN.Lyric = lyric; int len = GetLength(lyric); if (len > notePrev.Length) { // note length is too small return; } noteN.Length = len; notePrev.Length -= noteN.Length; uNotes[newNumber] = noteN; }
public static void Split(string number) { // Bisect all notes Dictionary <string, UNote> NewNotes = new Dictionary <string, UNote> { }; List <string> NewNumbers = new List <string> { }; string initNumber = Ust.Numbers[0]; int i = 0; string currentNumber; UNote note = uNotes[number]; UNote noteN = note.Copy(); int initLength = note.Length; note.Length = initLength * 2 / 3; noteN.Length = initLength - note.Length; noteN.SetDefaultNoteSettings(); currentNumber = UpgradeNumber(initNumber, i); NewNumbers.Add(currentNumber); NewNotes[currentNumber] = note; currentNumber = UpgradeNumber(initNumber, i, 10); NewNumbers.Add(currentNumber); NewNotes[currentNumber] = noteN; Ust.Numbers = NewNumbers.ToArray(); Ust.uNotes = NewNotes; }