Call Sevenzipsharp Extract File

Source: Internet
Author: User

3 Modes of operation

1. Get the path and extract files individually

DateTime beforDT1 = System.DateTime.Now;
Sevenzipextractor SevenZipExtractor1 = new Sevenzipextractor ("downloads.7z");
foreach (String it in Sevenzipextractor1.archivefilenames)
{
Console.WriteLine (it);

Sevenzipextractor1.extractfiles ("123", it);
}
Sevenzipextractor1.dispose ();
DateTime afterDT1 = System.DateTime.Now;
TimeSpan ts1 = afterdt1.subtract (beforDT1);
Console.WriteLine ("DateTime total Cost {0}ms.", Ts1. TotalMilliseconds);

2, get the path, one-time full decompression

DateTime Befordt = System.DateTime.Now;
Sevenzipextractor sevenzipextractor = new Sevenzipextractor ("downloads.7z");
list<string> files = new list<string> ();
foreach (String it in Sevenzipextractor.archivefilenames)
{
Console.WriteLine (it);

Files. ADD (IT);
}
Sevenzipextractor.extractfiles ("Downloads1", files. ToArray ());
Sevenzipextractor.dispose ();
DateTime Afterdt = System.DateTime.Now;
TimeSpan ts = afterdt.subtract (Befordt);
Console.WriteLine ("DateTime total Cost {0}ms.", TS.) TotalMilliseconds);

3. Directly unzip the catalogue

DateTime beforDT2 = System.DateTime.Now;
Sevenzipextractor SevenZipExtractor2 = new Sevenzipextractor ("downloads.7z");
Sevenzipextractor2.extractarchive ("Downloads2");
DateTime afterDT2 = System.DateTime.Now;
TimeSpan ts2 = afterdt2.subtract (beforDT2);
Sevenzipextractor2.dispose ();
Console.WriteLine ("DateTime total Cost {0}ms.", Ts2. TotalMilliseconds);

The 2nd and 3 approaches are time-consuming, relatively short, and the first class takes quite a bit longer.

Console.WriteLine ("DateTime total Cost ......");
Console.WriteLine ("DateTime total cost T1 {0}ms.", Ts1. TotalMilliseconds);
Console.WriteLine ("DateTime total cost t0 {0}ms.", TS. TotalMilliseconds);
Console.WriteLine ("DateTime total cost t2 {0}ms.", Ts2. TotalMilliseconds);

In the output result:

T1 49986.8883MS

T0 5974.8105ms

T2 6208.8108ms

Call Sevenzipsharp Extract File

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.