SaveFileTo() 공개 메소드

public SaveFileTo ( ulong hash, string extractPath, string fullName ) : void
hash ulong
extractPath string
fullName string
리턴 void
예제 #1
0
        public async Task ExtractInstallFiles(Action <int> progressCallback)
        {
            if (_casc == null)
            {
                return;
            }

            IProgress <int> progress = new Progress <int>(progressCallback);

            await Task.Run(() =>
            {
                var installFiles = _casc.Install.GetEntries("Windows");
                var build        = _casc.Config.BuildName;

                int numFiles = installFiles.Count();
                int numDone  = 0;

                foreach (var file in installFiles)
                {
                    if (_casc.Encoding.GetEntry(file.MD5, out EncodingEntry enc))
                    {
                        _casc.SaveFileTo(enc.Key, Path.Combine("data", build, "install_files"), file.Name);
                    }

                    progress.Report((int)(++numDone / (float)numFiles * 100));
                }
            });
        }
예제 #2
0
        private void ExtractFile(CASCFile file)
        {
            if (backgroundWorker1.CancellationPending)
            {
                throw new OperationCanceledException();
            }

            backgroundWorker1.ReportProgress((int)((float)++NumExtracted / (float)NumFiles * 100));

            cascHandler.SaveFileTo(file.FullName, ExtractPath, locale);
        }
예제 #3
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            foreach (var file in files)
            {
                if (backgroundWorker1.CancellationPending)
                {
                    e.Cancel = true;
                    break;
                }

                try
                {
                    backgroundWorker1.ReportProgress((int)((float)++NumExtracted / (float)files.Count * 100));

                    CASC.SaveFileTo(file.Hash, ExtractPath, file.FullName);
                }
                catch (Exception exc)
                {
                    Logger.WriteLine("Unable to extract file {0}: {1}", file.FullName, exc.Message);
                }
            }
        }