public static Zip ( Primitive zipFile, Primitive files ) : Primitive | ||
zipFile | Primitive | The zip archive file to create. |
files | Primitive | /// An array of files to append to the zip archive. /// A single file or directory may also be set. /// Any directories will be recursively added to the zip. /// Any white space in files or directories will be replaced with "_". /// |
return | Primitive |
public static Primitive Zip(Primitive zipFile, Primitive files)
{
try
{
using (Package zip = ZipPackage.Open(zipFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
if (SBArray.IsArray(files))
{
Primitive indices = SBArray.GetAllIndices(files);
int count = SBArray.GetItemCount(indices);
for (int i = 1; i <= count; i++)
{
AddToArchive(zip, files[indices[i]], "");
}
}
else
{
AddToArchive(zip, files, "");
}
zip.Close();
}
return "";
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
return Utilities.GetCurrentMethod() + " " + ex.Message;
}
}