예제 #1
0
파일: Ust.cs 프로젝트: MiranaM/roulade
        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;
        }
예제 #2
0
파일: Ust.cs 프로젝트: MiranaM/roulade
        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;
        }