public ScriptLine GetNearestLine(MidiTime time)
        {
            ScriptLine scriptLine = m_list;

            for (ScriptLine nextByTime = m_list.NextByTime; nextByTime != null && scriptLine.Offset < time; nextByTime = nextByTime.NextByTime)
            {
                if (Math.Abs(time.Difference(nextByTime.Offset)) < Math.Abs(time.Difference(scriptLine.Offset)))
                {
                    scriptLine = nextByTime;
                }
            }
            return(scriptLine);
        }
        public ScriptLine GetNearestLine(string character, MidiTime time)
        {
            ScriptLine scriptLine1 = m_list;

            while (scriptLine1 != null && scriptLine1.Character != character)
            {
                scriptLine1 = scriptLine1.NextByTime;
            }
            ScriptLine scriptLine2 = scriptLine1;

            for (ScriptLine nextByCharacter = scriptLine1.NextByCharacter; nextByCharacter != null && scriptLine2.Offset < time; nextByCharacter = nextByCharacter.NextByCharacter)
            {
                time.Difference(nextByCharacter.Offset);
                time.Difference(scriptLine2.Offset);
                if (Math.Abs(time.Difference(nextByCharacter.Offset)) < Math.Abs(time.Difference(scriptLine2.Offset)))
                {
                    scriptLine2 = nextByCharacter;
                }
            }
            return(scriptLine2);
        }