Esempio n. 1
0
        public override void Start(Task parentTask)
        {
            base.Start(parentTask);
            BackupTask parentBackupTask = (BackupTask)parentTask;

            var fileList = Directory.GetFiles(m_steamDir, "*.*", SearchOption.AllDirectories);

            try
            {
                m_wrapper = new SevenZipWrapper(m_backupDir, false);

                m_wrapper.Compressing            += Working;
                m_wrapper.FileCompressionStarted += Started;
                m_wrapper.CompressionFinished    += Finished;

                if (parentBackupTask.m_useLzma2)
                {
                    m_wrapper.UseLzma2Compression      = true;
                    m_wrapper.MultithreadingNumThreads = parentBackupTask.m_lzma2Threads;
                }

                int compressionLevel;
                switch (parentBackupTask.m_compLevel)
                {
                case 2:
                    compressionLevel = 3;
                    break;

                case 3:
                    compressionLevel = 5;
                    break;

                case 4:
                    compressionLevel = 7;
                    break;

                case 5:
                    compressionLevel = 9;
                    break;

                default:
                    compressionLevel = parentBackupTask.m_compLevel;
                    break;
                }

                m_wrapper.CompressionLevel  = compressionLevel;
                m_wrapper.UseMultithreading = true;

                m_wrapper.CompressFiles(Utilities.UpDirLvl(m_steamDir), fileList);
                m_wrapper.Dispose(false);
            }
            catch (Exception ex)
            {
                ErrorList.Add(new ErrorItem(ex.Message, this, ex.StackTrace));
            }
        }
Esempio n. 2
0
        public override void Start(Task parentTask)
        {
            base.Start(parentTask);

            try
            {
                m_wrapper = new SevenZipWrapper(m_backupDir, true);

                m_wrapper.Extracting            += Working;
                m_wrapper.FileExtractionStarted += Started;
                m_wrapper.ExtractionFinished    += Finished;

                m_wrapper.DecompressFileArchive(m_steamDir);
                m_wrapper.Dispose(true);
            }
            catch (Exception ex)
            {
                ErrorList.Add(new ErrorItem(ex.Message, this, ex.StackTrace));
            }
        }