private void ParseCue(string[] file) { //-1 means still global, //all others are track specific int trackOn = -1; AudioFile currentFile = new AudioFile(); for (int i = 0; i < file.Length; i++) { file[i] = file[i].Trim(); switch (file[i].Substring(0, file[i].IndexOf(' ')).ToUpper()) { case "CATALOG": ParseString(file[i], trackOn); break; case "CDTEXTFILE": ParseString(file[i], trackOn); break; case "FILE": currentFile = ParseFile(file[i], trackOn); break; case "FLAGS": ParseFlags(file[i], trackOn); break; case "INDEX": ParseIndex(file[i], trackOn); break; case "ISRC": ParseString(file[i], trackOn); break; case "PERFORMER": ParseString(file[i], trackOn); break; case "POSTGAP": ParseIndex(file[i], trackOn); break; case "PREGAP": ParseIndex(file[i], trackOn); break; case "REM": ParseComment(file[i], trackOn); break; case "SONGWRITER": ParseString(file[i], trackOn); break; case "TITLE": ParseString(file[i], trackOn); break; case "TRACK": trackOn++; ParseTrack(file[i], trackOn); if (currentFile.Filename != "") //if there's a file { m_Tracks[trackOn].DataFile = currentFile; currentFile = new AudioFile(); } break; default: ParseGarbage(file[i], trackOn); //save discarded junk and place string[] with track it was found in break; } } }