private async Task GetMediaFiles(PatcherFile[] files)
        {
            var currentVersion = new Version(File.ReadAllText(GetAssetsDirectory("VERSION_AIR")));

            if (!Directory.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "champions")))
                Directory.CreateDirectory(Path.Combine(Client.ExecutingDirectory, "Assets", "champions"));

            if (!Directory.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "sounds")))
                Directory.CreateDirectory(Path.Combine(Client.ExecutingDirectory, "Assets", "sounds"));

            if (!Directory.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "sounds", "champions")))
                Directory.CreateDirectory(Path.Combine(Client.ExecutingDirectory, "Assets", "sounds", "champions"));

            if (!Directory.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "sounds", "ambient")))
                Directory.CreateDirectory(Path.Combine(Client.ExecutingDirectory, "Assets", "sounds", "ambient"));

            if (!Directory.Exists(Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon")))
                Directory.CreateDirectory(Path.Combine(Client.ExecutingDirectory, "Assets", "profileicon"));

            //Select all files to calculate the size
            files =
                files.Where(
                    f =>
                        new Version(f.Version) > currentVersion && (f.SavePath.EndsWith(".jpg") || f.SavePath.EndsWith(".png") || f.SavePath.EndsWith(".mp3")) &&
                        (f.SavePath.Contains("assets/images/champions/") || f.SavePath.Contains("assets/images/abilities/") ||
                         f.SavePath.Contains("assets/storeImages/content/summoner_icon/") || (f.SavePath.Contains("assets/sounds/") && f.SavePath.Contains("en_US/champions/")) ||
                         (f.SavePath.Contains("assets/sounds/") && f.SavePath.Contains("assets/sounds/ambient")) ||
                         (f.SavePath.Contains("assets/sounds/") && f.SavePath.Contains("assets/sounds/matchmakingqueued.mp3")))).ToArray();

            _mediaTotalSize = files.Sum(s => s.FileSize);

            var humanSize = GetHumanSize(_mediaTotalSize);
            LogTextBox(String.Format("Downloading {0} files ({1}) from http://l3cdn.riotgames.com", files.Length, humanSize));

            await Task.Run(() => Parallel.ForEach(files, new ParallelOptions() {MaxDegreeOfParallelism = 10}, DoFileDownload));
        }
        private async Task DownloadTheme(PatcherFile[] files)
        {
            try
            {
                if (!Directory.Exists(GetAssetsDirectory("themes")))
                    Directory.CreateDirectory(GetAssetsDirectory("themes"));

                using (var wc = new WebClient())
                {
                    LogTextBox("Updating Theme");
                    await wc.DownloadFileTaskAsync(files.First(f => f.RelativePath.Contains("theme.properties")).AbsolutePath, GetAssetsDirectory("themes", "theme.properties"));
                }

                if (!File.Exists(GetAssetsDirectory("themes", "theme.properties")))
                    throw new Exception("Downloading of the file \"theme.properties\" failed");

                var theme = File.ReadAllLines(GetAssetsDirectory("themes", "theme.properties")).First(s => s.StartsWith("themeConfig=")).Split('=')[1].Split(',')[0];
                if (theme == "")
                    return;

                if (!Directory.Exists(GetAssetsDirectory("themes", theme)))
                    Directory.CreateDirectory(GetAssetsDirectory("themes", theme));
                else if (Directory.GetFiles(GetAssetsDirectory("themes", theme)).Any())
                {
                    Client.Theme = theme;
                    return;
                }

                var themePatcherFiles = files.Where(l => l.RelativePath.ToLower().Contains("loop") && l.RelativePath.Contains(theme)).ToList();
                Parallel.ForEach(themePatcherFiles,
                    new ParallelOptions {MaxDegreeOfParallelism = 10},
                    file =>
                    {
                        LogTextBox(String.Format("Downloading {0} ({1} KB) from http://l3cdn.riotgames.com", Path.GetFileName(file.RelativePath), file.FileSize/1024));
                        var fname = Path.GetFileName(file.RelativePath);
                        var localPath = GetAssetsDirectory("themes", theme, fname);
                        new WebClient().DownloadFile(file.AbsolutePath, localPath);
                    });

                var flv = Directory.GetFiles(GetAssetsDirectory("themes", theme), "*.flv");

                foreach (var item in flv)
                {
                    var inputFile = new MediaFile {Filename = GetAssetsDirectory("themes", theme, item)};

                    var outputFile = new MediaFile {Filename = GetAssetsDirectory("themes", theme, item).Replace(".flv", ".mp4")};

                    LogTextBox(String.Format("Converting {0}", Path.GetFileName(item)));
                    await Task.Run(() =>
                    {
                        using (var engine = new Engine())
                            engine.Convert(inputFile, outputFile);
                    });
                }
                Client.Theme = theme;
            }
            catch (Exception ex)
            {
                Client.Log(ex);
            }
        }