private IEnumerable <NFSFolder> readLines()
            {
                var    lines   = this.nfsLines;
                int    total   = lines.Length;
                double current = 0;

                var folderRegex = this.folderRegex;
                var fileRegex   = this.fileRegex;

                int folderIndex = 0;
                int fileIndex   = 0;

                NFSFolder currentFolder      = null;
                string    previousFolderName = null;
                string    previousFileName   = null;

                foreach (var line in lines)
                {
                    raiseProgressChanged(current++ / total, string.Format("reading \"{0}\"", line));

                    var folderMatch = folderRegex.Match(line);
                    if (folderMatch.Success)
                    {
                        string folderName = folderMatch.Groups["folder"].Value;

                        if (string.Equals(previousFolderName, folderName, StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }
                        previousFolderName = folderName;

                        currentFolder = new NFSFolder(folderIndex++, folderName);
                        yield return(currentFolder);

                        previousFileName = null;
                        fileIndex        = 0;

                        continue;
                    }

                    var fileMatch = fileRegex.Match(line);
                    if (fileMatch.Success)
                    {
                        var groups = fileMatch.Groups;

                        string name      = groups["file"].Value;
                        string filename  = groups["filename"].Value;
                        string extension = groups["extension"].Value;
                        long   size;
                        long.TryParse(groups["size"].Value, out size);
                        int order = getFileOrder(name, size);

                        //if there are two same file in same folder, unpack first one will get an empty file.
                        if (string.Equals(previousFileName, name, StringComparison.OrdinalIgnoreCase))
                        {
                            currentFolder.RemoveLastFile();
                        }
                        else
                        {
                            previousFileName = name;
                        }

                        var file = new NFSFile(filename, extension, currentFolder, fileIndex++, order, name, size);
                        currentFolder.Add(file);
                        continue;
                    }
                }
            }
 public void Add(NFSFile file)
 {
     this.files.Add(file);
 }