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