当前位置: 首页>>代码示例>>C#>>正文


C# SevenZipCompressor.BeginCompressDirectory方法代码示例

本文整理汇总了C#中SevenZip.SevenZipCompressor.BeginCompressDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# SevenZipCompressor.BeginCompressDirectory方法的具体用法?C# SevenZipCompressor.BeginCompressDirectory怎么用?C# SevenZipCompressor.BeginCompressDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SevenZip.SevenZipCompressor的用法示例。


在下文中一共展示了SevenZipCompressor.BeginCompressDirectory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: b_Compress_Click

 private void b_Compress_Click(object sender, EventArgs e)
 {
     SevenZipCompressor.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll");
     SevenZipCompressor cmp = new SevenZipCompressor();
     cmp.Compressing += new EventHandler<ProgressEventArgs>(cmp_Compressing);
     cmp.FileCompressionStarted += new EventHandler<FileNameEventArgs>(cmp_FileCompressionStarted);
     cmp.CompressionFinished += new EventHandler<EventArgs>(cmp_CompressionFinished);
     cmp.ArchiveFormat = (OutArchiveFormat)Enum.Parse(typeof(OutArchiveFormat), cb_Format.Text);
     cmp.CompressionLevel = (CompressionLevel)trb_Level.Value;
     cmp.CompressionMethod = (CompressionMethod)cb_Method.SelectedIndex;
     cmp.VolumeSize = chb_Volumes.Checked ? (int)nup_VolumeSize.Value : 0;
     string directory = tb_CompressDirectory.Text;
     string archFileName = tb_CompressOutput.Text;
     bool sfxMode = chb_Sfx.Checked;
     if (!sfxMode)
     {
         cmp.BeginCompressDirectory(directory, archFileName);
     }
     else
     {
         // Build SevenZipSharp with SFX
         /*SevenZipSfx sfx = new SevenZipSfx();
         using (MemoryStream ms = new MemoryStream())
         {
             cmp.CompressDirectory(directory, ms);
             sfx.MakeSfx(ms, archFileName.Substring(0, archFileName.LastIndexOf('.')) + ".exe");
         }*/
     }
 }
开发者ID:KOLANICH,项目名称:SevenZipSharp,代码行数:29,代码来源:FormMain.cs

示例2: CompressDirectory

 public static void CompressDirectory(string compressDirectory, string archFileName, OutArchiveFormat archiveFormat, CompressionLevel compressionLevel)
 {
     SevenZipCompressor.SetLibraryPath(LibraryPath);
     SevenZipCompressor cmp = new SevenZipCompressor();
     cmp.ArchiveFormat = archiveFormat;
     cmp.CompressionLevel = compressionLevel;
     cmp.BeginCompressDirectory(compressDirectory, archFileName);
 }
开发者ID:skt90u,项目名称:skt90u-framework-dotnet,代码行数:8,代码来源:SevenZipLib.cs

示例3: packToZip

        public void packToZip(String filePathArchive, String romFolder)
        {
            if(!Directory.Exists(tempPath)){
                Directory.CreateDirectory(tempPath);
            }

            archivePacker = new SevenZipCompressor(tempFolder);

            archivePacker.ArchiveFormat = OutArchiveFormat.Zip;
            archivePacker.BeginCompressDirectory(romFolder, filePathArchive, "");
        }
开发者ID:rockdesignes,项目名称:ROMCollectionManager,代码行数:11,代码来源:RomBackupArchiveManager.cs

示例4: Compress

 private void Compress(string directory, string archFileName)
 {
     SevenZipCompressor.SetLibraryPath(AppDomain.CurrentDomain.BaseDirectory + "7z.dll");
     SevenZipCompressor cmp = new SevenZipCompressor();
     cmp.Compressing += new EventHandler<ProgressEventArgs>(cmp_Compressing);
     cmp.FileCompressionStarted += new EventHandler<FileNameEventArgs>(cmp_FileCompressionStarted);
     cmp.CompressionFinished += new EventHandler<EventArgs>(cmp_CompressionFinished);
     cmp.ArchiveFormat = OutArchiveFormat.SevenZip;
     cmp.CompressionLevel = CompressionLevel.Normal;
     cmp.BeginCompressDirectory(directory, archFileName);
 }
开发者ID:450640526,项目名称:HtmExplorer,代码行数:11,代码来源:BackupForm.cs

示例5: b_Compress_Click

 private void b_Compress_Click(object sender, RoutedEventArgs e)
 {
     SevenZipCompressor.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll");
     SevenZipCompressor cmp = new SevenZipCompressor();
     cmp.Compressing += new EventHandler<ProgressEventArgs>(cmp_Compressing);
     cmp.FileCompressionStarted += new EventHandler<FileNameEventArgs>(cmp_FileCompressionStarted);
     cmp.CompressionFinished += new EventHandler<EventArgs>(cmp_CompressionFinished);
     cmp.ArchiveFormat = (OutArchiveFormat)Enum.Parse(typeof(OutArchiveFormat), cb_Format.Text);
     cmp.CompressionLevel = (CompressionLevel)slider_Level.Value;
     string directory = tb_CompressFolder.Text;
     string archFileName = tb_CompressArchive.Text;
     cmp.BeginCompressDirectory(directory, archFileName);
 }
开发者ID:Ethan6Lu,项目名称:SevenZipSharp,代码行数:13,代码来源:MainWindow.xaml.cs

示例6: build_Click

        private void build_Click(object sender, EventArgs e)
        {
            if (filesListView.Items.Count < 0) return;

            String randomPath = DateTime.Now.Millisecond.ToString();
            tempFolder = Path.GetTempPath() + @"Archive (" + DateTime.Now.ToString("dd.MM.yyyy - HH.mm.ss") + @")\";
            String type = outputTextBox.Text.Substring(outputTextBox.Text.LastIndexOf(@".") + 1);

            CheckFolder();
            CopyFiles(tempFolder);

            if (!String.IsNullOrEmpty(outputTextBox.Text))
            {
                StatusRichTextBox.Text += "[" + DateTime.Now.ToString("dd.MM.yyyy - HH.mm.ss") + "] " + "Archiving window opened." + Environment.NewLine;
                if (cmbFormat.SelectedIndex <= 2)
                {
                    StatusProgressBar.Style = ProgressBarStyle.Blocks;
                    SevenZipCompressor.SetLibraryPath(Application.StartupPath + @"\resources\7z\7zLib.dll");
                    SevenZipCompressor cmp = new SevenZipCompressor();
                    cmp.Compressing += new EventHandler<ProgressEventArgs>(cmp_Compressing);
                    cmp.FileCompressionStarted += new EventHandler<FileNameEventArgs>(cmp_FileCompressionStarted);
                    cmp.CompressionFinished += new EventHandler<EventArgs>(cmp_CompressionFinished);
                    cmp.ArchiveFormat = (OutArchiveFormat)Enum.Parse(typeof(OutArchiveFormat), cmbFormat.Text);
                    cmp.CompressionLevel = (CompressionLevel)int.Parse(cmbLevel.Text);
                    cmp.CompressionMethod = (CompressionMethod)Enum.Parse(typeof(CompressionMethod), cmbMethod.Text);
                    if (String.IsNullOrEmpty(passwordTextBox.Text))
                        cmp.BeginCompressDirectory(tempFolder, outputTextBox.Text);
                    else
                        cmp.BeginCompressDirectory(tempFolder, outputTextBox.Text, passwordTextBox.Text);
                }
                else
                {
                    StatusProgressBar.Style = ProgressBarStyle.Marquee;
                    StatusProgressBar.Value = 1;
                    if (cmbFormat.SelectedIndex == 3)
                    {
                        Classes.Algorithms.Compressing.SevenZip archiver = new Classes.Algorithms.Compressing.SevenZip(Application.StartupPath + @"\resources\7z\7z.exe");
                        archiver.Add(tempFolder);
                        archiver.ProcessFinished += new EventHandler(cmp_CompressionFinished);
                        archiver.GenerateArchive(outputTextBox.Text);
                    }
                    else if (cmbFormat.SelectedIndex == 4)
                    {
                        PAQ8O archiver = new PAQ8O(Application.StartupPath + @"\resources\paq\paq8o.exe");
                        archiver.CompressionLevel = cmbLevel.Text;
                        archiver.Add(tempFolder);
                        archiver.ProcessFinished += new EventHandler(cmp_CompressionFinished);
                        archiver.GenerateArchive(outputTextBox.Text);
                    }
                    else if (cmbFormat.SelectedIndex == 5)
                    {
                        ARC archiver = new ARC(Application.StartupPath + @"\resources\arc\Arc.exe");
                        archiver.CompressionLevel = cmbLevel.Text;
                        archiver.Add(tempFolder.Remove(tempFolder.Length - 1));
                        archiver.ProcessFinished += new EventHandler(cmp_CompressionFinished);
                        archiver.GenerateArchive(outputTextBox.Text);
                    }
                    else if (cmbFormat.SelectedIndex == 6)
                    {
                        Classes.Algorithms.Compressing.SevenZip archiver = new Classes.Algorithms.Compressing.SevenZip(Application.StartupPath + @"\resources\7z\7z.exe");
                        archiver.CompressionMethod = cmbMethod.Text;
                        archiver.Password = passwordTextBox.Text;
                        archiver.Add(tempFolder);
                        archiver.ProcessFinished += new EventHandler(cmp_CompressionFinished);
                        archiver.GenerateSFX(outputTextBox.Text);
                    }
                }
            }
            else
            {
                Save();
            }
        }
开发者ID:wyterzzz,项目名称:archivizer,代码行数:73,代码来源:ArchiveForm.cs


注:本文中的SevenZip.SevenZipCompressor.BeginCompressDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。