LyricsEngine.LRC.SimpleLRCTimeAndLineCollection.GetSimpleLRCTimeAndLineIndex C# (CSharp) Method

GetSimpleLRCTimeAndLineIndex() public method

public GetSimpleLRCTimeAndLineIndex ( long time ) : int
time long
return int
        public int GetSimpleLRCTimeAndLineIndex(long time)
        {
            if (time <= ((SimpleLRCTimeAndLine) _items[0]).Time)
            {
                return 0;
            }

            for (var i = 1; i < _items.Length; i++)
            {
                if (((SimpleLRCTimeAndLine) _items[i - 1]).Time < time &&
                    time <= ((SimpleLRCTimeAndLine) _items[i]).Time)
                {
                    return i;
                }
            }

            if (time > ((SimpleLRCTimeAndLine) _items[_items.Length - 1]).Time)
            {
                return _items.Length - 1;
            }
            throw (new IndexOutOfRangeException("IndexOutOfRangeException in GetSimpleLRCTimeAndLineIndex"));
        }