本文整理匯總了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");
}*/
}
}
示例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);
}
示例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, "");
}
示例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);
}
示例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);
}
示例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();
}
}