public void Update(FileObject file, float pourcentage, long bytesReceived, long totalBytes)
        {
            if (file == null)
                return;
            if (Updating)
                return;

            if (DateTime.Now.Subtract(LastUpdate).TotalMilliseconds > 1000)
            {
                Updating = true;
                LastUpdate = DateTime.Now;

                int y = Console.CursorTop;

                SetText("Downloading : " + AlignText(file.Path, 50, false), ConsoleColor.Yellow, 0, y + 1);
                SetText(
                    "File        : " +
                    AlignText(
                        CurrentFileIndex.ToString(CultureInfo.InvariantCulture) + "/" +
                        FilesCount.ToString(CultureInfo.InvariantCulture), 50, false), ConsoleColor.Yellow, 0, y + 2);
                SetText("File Size   : " + AlignText(HumanReadableByteCount(totalBytes), 50, false), ConsoleColor.Yellow,
                        0, y + 3);
                SetText("Downloaded  : " + AlignText(HumanReadableByteCount(bytesReceived), 50, false),
                        ConsoleColor.Yellow, 0, y + 4);
                SetText(
                    "Pourcent    : " + AlignText(pourcentage.ToString(CultureInfo.InvariantCulture) + "%", 50, false),
                    ConsoleColor.Yellow, 0, y + 5);

                Console.CursorTop = y;

                Updating = false;
            }
        }
Exemplo n.º 2
0
        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" && WoWRegeneration.CurrentSession.Locale != "All" && 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 (WoWRegeneration.CurrentSession.Locale == "All" || file.Directory.StartsWith("Data/" + WoWRegeneration.CurrentSession.Locale))
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        public List<FileObject> GenerateFileList()
        {
            WoWRepository repository = RepositoriesManager.GetRepositoryByMfil(WoWRegeneration.CurrentSession.MFil);

            var tmp = new List<FileObject>();

            foreach (string line in Lines)
            {
                if (IsLineARepositorFile(repository, line))
                {
                    var file = new FileObject { Path = GetFilePath(line) };
                    if (file.Path == null)
                        continue;
                    file.Url = line;
                    file.Info = GetFileInfo(repository, line);
                    if (IsAcceptedFile(repository, file))
                        tmp.Add(file);
                }
            }

            return tmp;
        }