public FileDownloader(WoWRepository repository, List<FileObject> files)
        {
            Files = files;
            BasePath = repository.GetDefaultDirectory();

            Progress = new ConsoleDownloadProgressBar(Files.Count);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new UI.ProgressBar());
        }
        private bool IsAcceptedFile(WoWRepository repository, FileObject file)
        {
            if (WoWRegeneration.CurrentSession.Os == "Win" && file.Filename == "base-OSX.MPQ")
                return false;

            if (WoWRegeneration.CurrentSession.Os == "OSX" && file.Filename == "base-Win.MPQ")
                return false;

            if (file.Filename == "alternate.MPQ" && file.Info != WoWRegeneration.CurrentSession.Locale)
                return false;

            if (WoWRegeneration.CurrentSession.CompletedFiles.Contains(file.Path) &&
                File.Exists(Program.ExecutionPath + repository.GetDefaultDirectory() + file.Path))
            {
                Program.Log("Skipping " + file.Filename + " allready downloaded", ConsoleColor.DarkGray);
                return false;
            }

            if (WoWRegeneration.CurrentSession.CompletedFiles.Contains(file.Path))
            {
                WoWRegeneration.CurrentSession.CompletedFiles.Remove(file.Path);
                WoWRegeneration.CurrentSession.SaveSession();
            }

            if (file.Directory == "Data/")
            {
                return true;
            }

            if (file.Directory.StartsWith("Data/Interface/"))
            {
                return true;
            }

            if (file.Directory.StartsWith("Data/" + WoWRegeneration.CurrentSession.Locale))
            {
                return true;
            }
            return false;
        }
        public static ManifestFile FromRepository(WoWRepository repository)
        {
            try
            {
                var manifest = new ManifestFile();
                var client = new WebClient();

                string content = client.DownloadString(repository.GetBaseUrl() + repository.GetMFilName());

                string[] lines = content.Split('\n');

                foreach (string line in lines)
                {
                    if (line.Trim().StartsWith("version="))
                    {
                        int output;
                        if (int.TryParse(line.Trim().Replace("version=", ""), out output))
                        {
                            manifest.Version = output;
                        }
                    }
                    manifest.Lines.Add(line.Trim().Replace("file=", repository.GetBaseUrl()));
                }

                return manifest;
            }
            catch (Exception ex)
            {
                Program.Log("Unable to retrieve Manifest file", ConsoleColor.Red);
                Program.Log(ex.Message, ConsoleColor.Red);
            }
            return null;
        }
 private bool IsLineARepositorFile(WoWRepository repository, string line)
 {
     if (line.StartsWith(repository.GetBaseUrl()))
     {
         if (line.Substring(line.Length - 4, 1) == ".")
         {
             return true;
         }
     }
     return false;
 }
 private string GetFileInfo(WoWRepository repository, string line)
 {
     int index = Lines.IndexOf(line);
     for (int n = 1; n <= 5; n++)
     {
         string next = Lines[index + n];
         if (IsLineARepositorFile(repository, next))
             return null;
         if (next.StartsWith("path=locale_"))
             return next.Replace("path=locale_", "");
     }
     return null;
 }