private int LoadChartSong(Song.Info info, string[] chart, int i)
    {
        int timeout = 100000;

        while (i < timeout)
        {
            if (chart[i].Contains("{"))
            {
                //Debug.Log("Start reading song info");
                i++;
                break;
            }
            i++;
        }
        while (i < timeout)
        {
            if (chart[i].Contains("}"))
            {
                //Debug.Log("End reading song info");
                break;
            }
            if (chart[i].Contains("Resolution"))
            {
                info.resolution = uint.Parse(chart[i].Split(new string[] { " = " }, System.StringSplitOptions.None)[1]);
            }
            i++;
        }
        return(i);
    }
    private void Parse()
    {
        string gotError = null;

        try
        {
            string fullFileName;
            lock (lockObject)
            {
                fullFileName = song.fileInfo.FullName;
            }
            string[]   chart = File.ReadAllLines(fullFileName);
            Song.Notes notes = new Song.Notes();
            notes.easy   = new List <Song.Note>();
            notes.medium = new List <Song.Note>();
            notes.hard   = new List <Song.Note>();
            notes.expert = new List <Song.Note>();
            List <Song.SyncTrack> syncTrack = new List <Song.SyncTrack>();
            List <Song.SongEvent> events    = new List <Song.SongEvent>();
            Song.Info             info      = new Song.Info();
            //Debug.Log(chart.Length);
            for (int i = 0; i < chart.Length; ++i)
            {
                if (chart[i].Contains("[Song]"))
                {
                    i = LoadChartSong(info, chart, i); continue;
                }
                if (chart[i].Contains("[SyncTrack]"))
                {
                    i = LoadChartSyncTrack(syncTrack, chart, i); continue;
                }
                if (chart[i].Contains("[Events]"))
                {
                    i = LoadChartEvents(events, chart, i); continue;
                }
                if (chart[i].Contains("[ExpertSingle]"))
                {
                    i = LoadChartNotes(chart, i, notes.expert, info.resolution); continue;
                }
                if (chart[i].Contains("[HardSingle]"))
                {
                    i = LoadChartNotes(chart, i, notes.hard, info.resolution); continue;
                }
                if (chart[i].Contains("[MediumSingle]"))
                {
                    i = LoadChartNotes(chart, i, notes.medium, info.resolution); continue;
                }
                if (chart[i].Contains("[EasySingle]"))
                {
                    i = LoadChartNotes(chart, i, notes.easy, info.resolution); continue;
                }
            }
            Song.Data data = new Song.Data();
            data.syncTrack = syncTrack;
            data.info      = info;
            data.events    = events;
            data.notes     = notes;
            song.data      = data;
        }
        catch (System.Exception e)
        {
            gotError = e.Message + " - " + e.StackTrace;
        }
        lock (lockObject)
        {
            error      = gotError;
            song.ready = true;
        }
    }