Пример #1
0
 private static void sshCp_OnTransferProgress(string src, string dst, int transferredBytes, int totalBytes, string message)
 {
     if (progressBar != null)
     {
         progressBar.Update(transferredBytes, totalBytes, message);
     }
 }
Пример #2
0
 private static void sshCp_OnTransferProgress(string src, string dst, int transferredBytes, int totalBytes, string message)
 {
     if (progressBar != null)
     {
         StringBuilder temp = progressBar.Update(transferredBytes, totalBytes, message);
         // traceHandler(temp.ToString());
     }
 }
Пример #3
0
        public void Start()
        {
            CurrentFileIndex = 0;

            Program.Log("Downloading " + Files.Count + " Files", ConsoleColor.Yellow);
            DownloadNextFile();

            Console.CursorLeft = 0;
            Progress.Update(CurrentFile, 0, 0, 0);

            while (CurrentFile != null)
            {
                Thread.Sleep(100);
            }

            Console.Clear();
        }
Пример #4
0
        private static void sshCp_OnTransferStart(string src, string dst, int transferredBytes, int totalBytes, string message)
        {
            Console.WriteLine();
            progressBar = new ConsoleProgressBar();
            StringBuilder temp = progressBar.Update(transferredBytes, totalBytes, message);

            traceHandler(temp.ToString());
        }
Пример #5
0
        /// <summary>
        /// Moves the files from the chunked archive to a flat file one
        /// </summary>
        /// <param name="archivename"></param>
        /// <param name="block"></param>
        private void DoFileSwap(string archivename, string block)
        {
            Directory.CreateDirectory("Temp");

            string filename = Path.GetFileName(archivename);

            using (var mpq = MpqArchive.CreateNew(archivename, MpqArchiveVersion.Version3))
                using (var tmp = new MpqArchive(block, FileAccess.Read, OpenArchiveFlags.BLOCK4))
                {
                    if (TryGetFileList(tmp, false, out var lf))
                    {
                        _progressBar.Start();

                        string tempPath;
                        for (int i = 0; i < lf.Count; i++)
                        {
                            using (var fs = tmp.OpenFile(lf[i]))
                            {
                                // incremental patch files can't be written directly with StormLib SFileCreateFile?
                                if ((fs.TFileEntry.dwFlags & 0x100000u) != 0x100000u)
                                {
                                    mpq.AddFileFromStream(fs);
                                }
                                else
                                {
                                    tempPath = Path.Combine("Temp", lf[i]);
                                    Directory.CreateDirectory(Path.GetDirectoryName(tempPath));

                                    tmp.ExtractFile(lf[i], tempPath);
                                    mpq.AddFileFromDisk(tempPath, lf[i], fs.TFileEntry.dwFlags);
                                }
                            }

                            _progressBar.Update(filename, i / (float)lf.Count);

                            if (i % 10000 == 0)
                            {
                                mpq.Flush();
                            }
                        }
                    }
                }

            Console.WriteLine("Emptying Temp Folder...");
            DeleteDirectory("Temp");
            _progressBar.Stop();
        }
Пример #6
0
 private static void sshCp_OnTransferStart(string src, string dst, int transferredBytes, int totalBytes, string message)
 {
     Console.WriteLine();
     progressBar = new ConsoleProgressBar();
     progressBar.Update(transferredBytes, totalBytes, message);
 }
Пример #7
0
 private static void sshCp_OnTransferStart(string src, string dst, int transferredBytes, int totalBytes, string message)
 {
     Console.WriteLine();
     progressBar = new ConsoleProgressBar();
     progressBar.Update(transferredBytes, totalBytes, message);
 }