Hi, I have been using the Ionic.zip namespace for the zipping program. But I have seen that you should provide the name of the .zip file in C# program everytime and if the user has to zip many files he cannot go the sourcecode and change the program line everytime so I copied the sourcepath to a variable & then sourcepath/destddir should be given as input to "zip.save();" method so the new zipfile is named with the same name and the path would remain same as the directory from which it has been taken from.
public void button2_Click(object sender, EventArgs e) {
String sourcepath = System.IO.Path.GetFullPath(openFileDialog1.FileName);
MessageBox.Show(sourcepath);
String destdir = System.IO.Path.GetDirectoryName(openFileDialog1.FileName);
MessageBox.Show(destdir);
try
{
using (ZipFile zip = new ZipFile())
{
zip.AddFile(sourcepath);
zip.Save(@"d:\todayTest2\myplate.zip");// Can I write this as zip.Save(sourcepath+ .zip); ??
}
label1.Text = "zipped";
}
I need to know the exact syntax of zip.save() method and Is it possible to give a variable as input to that method for saving a zip file. Thanks!