Hello all,
I am trying to create an installer for my program. Which can unzip the folder in which it is downloaded. The Download part works fine. But I am repeatedly getting the error that the my file path is invalid during the unzip proces.
This is where I am trying to get the unzip method:
This is the unzip proces itself:
I am trying to create an installer for my program. Which can unzip the folder in which it is downloaded. The Download part works fine. But I am repeatedly getting the error that the my file path is invalid during the unzip proces.
This is where I am trying to get the unzip method:
Code:
string dirpath = sfd.FileName;
DirectoryInfo di = new DirectoryInfo(dirpath);
foreach(FileInfo fi in di.GetFiles("MyProgram.zip"))
{
Decompress(fi);
}
Code:
using (FileStream inFile = fi.OpenRead())
{
string curFile = fi.FullName;
string origName = curFile.Remove(curFile.Length - fi.Extension.Length);
using (FileStream outFile = File.Create(origName))
{
using (GZipStream Decompress = new GZipStream(inFile,CompressionMode.Decompress))
{
Decompress.CopyTo(outFile);
}
}
}
Comment