private UserFiles ParsePage(UnitType type, String page)
        {
            var list = new UserFiles(type);

            foreach (var i in page.Split(new[] { "<div class=\"col-xs-2 text-center\">" }, StringSplitOptions.None).Skip(1))
            {
                var endIndex = i.IndexOf("class=\"btn btn-default pull-right\">Detail");
                if (endIndex < 0)
                {
                    continue;
                }
                var userFile   = new UserFile(type);
                var dataString = i.Substring(0, endIndex);

                var match = Regex.Match(dataString, "<h2><a href=\"\\/en\\/files\\/(.+)\\/\">(.+)<\\/a>");
                userFile.Id           = match.Groups[1].Value;
                userFile.Name         = WebUtility.HtmlDecode(match.Groups[2].Value.Trim());
                userFile.Author       = WebUtility.HtmlDecode(Regex.Match(dataString, "Author - <a href=\".+\">(.+)<\\/a>").Groups[1].Value.Trim());
                userFile.Date         = Regex.Match(dataString, "Date - (.+)<\\/div>").Groups[1].Value.Trim();
                userFile.Description  = WebUtility.HtmlDecode(Regex.Match(dataString, "<div class=\"row file-preview-text\">[\\s\\S]+?>([\\s\\S]+?)<\\/div>").Groups[1].Value.Replace("\n", "").Trim().Replace("<br />", "\n"));
                userFile.Size         = Regex.Match(dataString, "Size:<\\/b>(.+)<\\/li>").Groups[1].Value.Trim();
                userFile.Downloads    = Regex.Match(dataString, "Downloaded:<\\/b>(.+)<\\/li>").Groups[1].Value.Trim();
                userFile.DownloadLink = WebUtility.HtmlDecode(Regex.Match(dataString, "<a href=\"(.+?)\">Download<\\/a>").Groups[1].Value.Trim());
                var matches = Regex.Matches(dataString, "<a href=\"\\/upload\\/iblock(.+?)\"");
                userFile.Preview = new string[matches.Count];
                for (var j = 0; j < userFile.Preview.Length; j++)
                {
                    userFile.Preview[j] = matches[j].Groups[1].Value;
                }
                list.Files.Add(userFile);
            }

            return(list);
        }
 public void Load(UserFiles files)
 {
     UserFiles.Clear();
     //UserFiles.Add(new UserFileData(files.Files[0], dataLoader));
     files.Files
     .Take(20).ToList()
     .ForEach(x => UserFiles.Add(new UserFileData(x, _dataLoader)));
 }
        private void CheckDownloadedFiles(UserFiles list)
        {
            var moduleDir = Path.Combine(DcsInstallDirectory, "Liveries", list.UnitType.DirectoryName());

            if (!Directory.Exists(moduleDir))
            {
                return;
            }
            var dirs = Directory.GetDirectories(moduleDir).Select(dir =>
            {
                dir       = Path.GetFileName(dir);
                var index = dir.IndexOf('.');
                return(index == -1 ? String.Empty : dir.Substring(0, index));
            }).ToArray();

            foreach (var file in list.Files)
            {
                file.Downloaded = dirs.Any(str => str.Equals(file.Id));
            }
        }