本文整理汇总了C#中SevenZip.SevenZipExtractor.BeginExtractArchive方法的典型用法代码示例。如果您正苦于以下问题:C# SevenZipExtractor.BeginExtractArchive方法的具体用法?C# SevenZipExtractor.BeginExtractArchive怎么用?C# SevenZipExtractor.BeginExtractArchive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SevenZip.SevenZipExtractor
的用法示例。
在下文中一共展示了SevenZipExtractor.BeginExtractArchive方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: wc_DownloadFileCompleted
void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
if (e.Error != null)
{
MessageBox.Show(e.Error.Message, "Error");
Application.Exit();
}
lblStatus.Text = "Decompressing...";
probar.Style = ProgressBarStyle.Blocks;
SevenZipExtractor extractor = new SevenZip.SevenZipExtractor(Application.StartupPath + "\\Update.zip");
extractor.Extracting += new EventHandler<ProgressEventArgs>(extractor_Extracting);
extractor.ExtractionFinished += new EventHandler<EventArgs>(extractor_ExtractionFinished);
extractor.BeginExtractArchive(Application.StartupPath);
}
示例2: ExtractArchive
/// <summary>
/// Extracts and archive to the given directory
/// </summary>
/// <param name="inFile">Path to the archive to extract</param>
/// <param name="outDir">The path to the target directory for extraction</param>
public static void ExtractArchive(string inFile, string outDir)
{
SevenZipBase.SetLibraryPath(PathHelper.SevenZipLibrary);
try
{
_extractor = new SevenZipExtractor(inFile);
if (!Directory.Exists(outDir))
Directory.CreateDirectory(outDir);
_extractor.ExtractionFinished += ExtractorExtractionFinished;
_extractor.BeginExtractArchive(outDir);
}
catch
{
MessageBox.Show("Failed to extract ARChive.",
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
示例3: Extract7zAsync
public static Task Extract7zAsync(string file, string outDir, IProgress<int> progress)
{
return Task.Run(() =>
{
var libPath = Path.Combine("7zip", "7z.dll");
SevenZipExtractor.SetLibraryPath(libPath);
SevenZipExtractor extractor = new SevenZipExtractor(file);
ManualResetEvent mre = new ManualResetEvent(false);
extractor.Extracting += (sender, e) => progress.Report(e.PercentDone);
extractor.ExtractionFinished += (sender, e) => mre.Set();
extractor.BeginExtractArchive(outDir);
mre.WaitOne();
});
}
示例4: miExtractHere_Click
private void miExtractHere_Click(object sender, RoutedEventArgs e)
{
Dispatcher.BeginInvoke(
System.Windows.Threading.DispatcherPriority.Background,
new ThreadStart(
delegate()
{
string FileName = Explorer.SelectedItems[0].ParsingName;
SevenZipExtractor extractor = new SevenZipExtractor(FileName);
string DirectoryName = System.IO.Path.GetDirectoryName(FileName);
string ArchName = System.IO.Path.GetFileNameWithoutExtension(FileName);
extractor.Extracting += new EventHandler<ProgressEventArgs>(extractor_Extracting);
extractor.ExtractionFinished += new EventHandler<EventArgs>(extractor_ExtractionFinished);
extractor.FileExtractionStarted += new EventHandler<FileInfoEventArgs>(extractor_FileExtractionStarted);
extractor.FileExtractionFinished += new EventHandler<FileInfoEventArgs>(extractor_FileExtractionFinished);
extractor.PreserveDirectoryStructure = true;
string Separator = "";
if (DirectoryName[DirectoryName.Length - 1] != Char.Parse(@"\"))
{
Separator = @"\";
}
AddToLog("Extracted Archive to " + DirectoryName + Separator + ArchName + " from source " + FileName);
extractor.BeginExtractArchive(DirectoryName + Separator + ArchName);
}));
}
示例5: b_Extract_Click
private void b_Extract_Click(object sender, EventArgs e)
{
SevenZipExtractor.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll");
string fileName = tb_ExtractArchive.Text;
string directory = tb_ExtractDirectory.Text;
var extr = new SevenZipExtractor(fileName);
pb_ExtractWork.Maximum = (int)extr.FilesCount;
extr.Extracting += new EventHandler<ProgressEventArgs>(extr_Extracting);
extr.FileExtractionStarted += new EventHandler<FileInfoEventArgs>(extr_FileExtractionStarted);
extr.FileExists += new EventHandler<FileOverwriteEventArgs>(extr_FileExists);
extr.ExtractionFinished += new EventHandler<EventArgs>(extr_ExtractionFinished);
extr.BeginExtractArchive(directory);
}
示例6: b_Extract_Click
private void b_Extract_Click(object sender, RoutedEventArgs e)
{
SevenZipExtractor.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll");
tb_Messages.Text = "Started" + Environment.NewLine;
string fileName = tb_ExtractArchive.Text;
string directory = tb_ExtractFolder.Text;
var extractor = new SevenZipExtractor(fileName);
extractor.Extracting += new EventHandler<ProgressEventArgs>(extr_Extracting);
extractor.FileExtractionStarted += new EventHandler<FileInfoEventArgs>(extr_FileExtractionStarted);
extractor.FileExists += new EventHandler<FileOverwriteEventArgs>(extr_FileExists);
extractor.ExtractionFinished += new EventHandler<EventArgs>(extr_ExtractionFinished);
extractor.BeginExtractArchive(directory);
}
示例7: miExtractHere_Click
private void miExtractHere_Click(object sender, RoutedEventArgs e) {
string FileName = _ShellListView.GetFirstSelectedItem().ParsingName;
var extractor = new SevenZipExtractor(FileName);
string DirectoryName = Path.GetDirectoryName(FileName);
string ArchName = Path.GetFileNameWithoutExtension(FileName);
extractor.Extracting += new EventHandler<ProgressEventArgs>(extractor_Extracting);
extractor.ExtractionFinished += new EventHandler<EventArgs>(extractor_ExtractionFinished);
extractor.FileExtractionStarted += new EventHandler<FileInfoEventArgs>(extractor_FileExtractionStarted);
extractor.FileExtractionFinished += new EventHandler<FileInfoEventArgs>(extractor_FileExtractionFinished);
extractor.PreserveDirectoryStructure = true;
string Separator = "";
if (DirectoryName[DirectoryName.Length - 1] != Char.Parse(@"\")) Separator = @"\";
AddToLog($"Extracted Archive to {DirectoryName}{Separator}{ArchName} from source {FileName}");
extractor.BeginExtractArchive(DirectoryName + Separator + ArchName);
}
示例8: ExtractArchive
public static void ExtractArchive(string archFileName, string extractFolder)
{
SevenZipExtractor.SetLibraryPath(LibraryPath);
var extractor = new SevenZipExtractor(archFileName);
extractor.BeginExtractArchive(extractFolder);
}