C
C#•10mo ago
Paulem.

7zip file progression

Hello, how can I get the extraction progression of a 7z file from my WinForms app?
50 Replies
Buddy
Buddy•10mo ago
Show what you have currently $paste
MODiX
MODiX•10mo ago
If your code is too long, you can post to https://paste.mod.gg/ and copy the link into chat for others to see your shared code!
Paulem.
Paulem.OP•10mo ago
using System;
using System.Diagnostics;

namespace BloodRushInstaller.utils
{
public class ZipManager
{
public static void ExtractFile(string sourceArchive, string destination)
{
string zPath = AppDomain.CurrentDomain.BaseDirectory + @"7zip/7za.exe"; //add to proj and set CopyToOuputDir
ProcessStartInfo pro = new ProcessStartInfo
{
WindowStyle = ProcessWindowStyle.Hidden,
FileName = zPath,
Arguments = string.Format("x \"{0}\" -y -o\"{1}\"", sourceArchive, destination)
};
Process x = Process.Start(pro);
x.WaitForExit();
}
}
}
using System;
using System.Diagnostics;

namespace BloodRushInstaller.utils
{
public class ZipManager
{
public static void ExtractFile(string sourceArchive, string destination)
{
string zPath = AppDomain.CurrentDomain.BaseDirectory + @"7zip/7za.exe"; //add to proj and set CopyToOuputDir
ProcessStartInfo pro = new ProcessStartInfo
{
WindowStyle = ProcessWindowStyle.Hidden,
FileName = zPath,
Arguments = string.Format("x \"{0}\" -y -o\"{1}\"", sourceArchive, destination)
};
Process x = Process.Start(pro);
x.WaitForExit();
}
}
}
For my ZipManager
canton7
canton7•10mo ago
Can you get 7-zip to print progress information?
Paulem.
Paulem.OP•10mo ago
I'm currently trying that and I think I can but then I'll need to get the informations from the console
Buddy
Buddy•10mo ago
Reading from console is easy As long as you have something to write to console
Paulem.
Paulem.OP•10mo ago
it seems there is no progression information
Paulem.
Paulem.OP•10mo ago
Stack Overflow
Extract ZipFile Using C# With Progress Report
Can anyone tell me if it is possible(and give an example if it is) on how to have a progress bar(and status label if possible) showing the progress of a ZIP file being extracted using "ZipFile"(Ion...
Buddy
Buddy•10mo ago
7zip and zip are completely different formats
Paulem.
Paulem.OP•10mo ago
but ZipFile support .rar ?
Buddy
Buddy•10mo ago
Afaik yes, but not 7z
Paulem.
Paulem.OP•10mo ago
but if I convert the 7z to a zip... ?
Buddy
Buddy•10mo ago
Then sure?
Paulem.
Paulem.OP•10mo ago
I found nothing on internet to do that locally
Buddy
Buddy•10mo ago
That'll work
Paulem.
Paulem.OP•10mo ago
Maybe I need to include LZMA SDK to my project and edit it to show progress https://7-zip.org/sdk.html
Buddy
Buddy•10mo ago
Why not just zip it as a normal zip?
Paulem.
Paulem.OP•10mo ago
'cause it's on internet and the diff between zip (1.8Go) and 7z (600Mo) is incredible so it's better downloading with 7z
Buddy
Buddy•10mo ago
I guess you can convert it? But that requires either using libraries or reading up on the format and do the conversion yourself
Paulem.
Paulem.OP•10mo ago
hummm
Buddy
Buddy•10mo ago
https://github.com/adoconnection/SevenZipExtractor This does exist But it's fairly old
Paulem.
Paulem.OP•10mo ago
not very old 2 years for a zip format isn't old I think
Buddy
Buddy•10mo ago
It might not come with a progress though
Paulem.
Paulem.OP•10mo ago
Hummm I'll check
Paulem.
Paulem.OP•10mo ago
GitHub
Progress event · Issue #55 · adoconnection/SevenZipExtractor
I already tried, and I can unzip LZMA2 files without problem. But how can I have a Progress?
Paulem.
Paulem.OP•10mo ago
I think I found then 😄 thanks :) @Citizen of Pluto I think it's no longer possible to get the progression
Paulem.
Paulem.OP•10mo ago
oh thanks 😄 how can I import this into my project as a dependency? like a dll or something like that
Buddy
Buddy•10mo ago
You compile it
Paulem.
Paulem.OP•10mo ago
how do I compile 😅 compile to which format* (exe, dll... ?) @Citizen of Pluto
Buddy
Buddy•10mo ago
dll
Paulem.
Paulem.OP•10mo ago
do you have a tutorial or smth like that ? @Citizen of Pluto
Buddy
Buddy•10mo ago
just type dotnet build --configuration Release in the console and when in the root directory of said project
Paulem.
Paulem.OP•10mo ago
okay it generated this
SevenZipExtractor.Tests -> C:\Users\paule\Downloads\SevenZipExtractor\SevenZipExtractor.Tests\bin\Release\net45\Seven
ZipExtractor.Tests.dll
Benchmark -> C:\Users\paule\Downloads\SevenZipExtractor\Benchmark\bin\Release\net47\Benchmark.exe
Benchmark -> C:\Users\paule\Downloads\SevenZipExtractor\Benchmark\bin\Release\netcoreapp3.1\Benchmark.dll
SevenZipExtractor.Tests -> C:\Users\paule\Downloads\SevenZipExtractor\SevenZipExtractor.Tests\bin\Release\net45\Seven
ZipExtractor.Tests.dll
Benchmark -> C:\Users\paule\Downloads\SevenZipExtractor\Benchmark\bin\Release\net47\Benchmark.exe
Benchmark -> C:\Users\paule\Downloads\SevenZipExtractor\Benchmark\bin\Release\netcoreapp3.1\Benchmark.dll
Which one should I use? @Citizen of Pluto
Buddy
Buddy•10mo ago
type it when in SevenZipExtractor directory (not tests)
Paulem.
Paulem.OP•10mo ago
okay thanks oh okay I was in main I should use netstandard2.0 or net45?
Buddy
Buddy•10mo ago
netstandard Depends on what SDK you use Do you use .NET (Core or Standard) or .NET Framework?
Paulem.
Paulem.OP•10mo ago
let me check... .NET Framework 4.7.2 so ?
Paulem.
Paulem.OP•10mo ago
net45
No description
Paulem.
Paulem.OP•10mo ago
@Citizen of Pluto
Paulem.
Paulem.OP•10mo ago
netstandard 2.0
No description
Paulem.
Paulem.OP•10mo ago
x64 and x86 contains the 7z's dll
jcotton42
jcotton42•10mo ago
@Paulem. @Citizen of Pluto this may be more viable
No description
Paulem.
Paulem.OP•10mo ago
does it has the progression?
jcotton42
jcotton42•10mo ago
actually wait this might not wrap 7z.dll, but instead be it's own impl
Paulem.
Paulem.OP•10mo ago
no problem I just want to decompress with a progress bar
Paulem.
Paulem.OP•10mo ago
oh it's good for 7z but is it for progress?
jcotton42
jcotton42•10mo ago
I'll admit I didn't look for that first may have jumped the gun 😅
Paulem.
Paulem.OP•10mo ago
I almost implemented the version with SevenZipExtractor if it works then I keep it
Want results from more Discord servers?
Add your server