Exemple #1
0
        public void TestGeneralArchiveExtractionWithProgress()
        {
            BA2Archive archive          = BA2Loader.Load(SharedData.GeneralOneFileArchive);
            string     temp             = SharedData.CreateTempDirectory();
            int        progressValue    = 0;
            bool       progressReceived = false;
            var        progressHandler  = new Progress <int>(x =>
            {
                progressReceived = true;
                progressValue    = x;
            });

            archive.ExtractAll(temp, false, CancellationToken.None, progressHandler);

            // workaround of dumb test execution
            int waits = 0;

            while (!progressReceived)
            {
                if (waits > 10)
                {
                    break;
                }
                Thread.Sleep(25);
                waits++;
            }
            Assert.AreEqual(1, progressValue);
        }
Exemple #2
0
 public Task ExtractAllAsync(BA2Archive archive)
 {
     return(Task.Run(() => archive.ExtractAll("D:/stuff", true)));
 }