private void DoExportForHishop(string csvFilename, string imagePath, System.Collections.Generic.List <ExportToLocal.ProductDetail> list)
{
using (System.IO.FileStream fileStream = new System.IO.FileStream(csvFilename, System.IO.FileMode.Create, System.IO.FileAccess.Write))
{
string productCSVForEcdev = this.GetProductCSVForHishop(imagePath, list);
System.Text.UnicodeEncoding unicodeEncoding = new System.Text.UnicodeEncoding();
//UTF8Encoding unicodeEncoding = new UTF8Encoding();
int byteCount = unicodeEncoding.GetByteCount(productCSVForEcdev);
byte[] preamble = unicodeEncoding.GetPreamble();
byte[] array = new byte[preamble.Length + byteCount];
System.Buffer.BlockCopy(preamble, 0, array, 0, preamble.Length);
unicodeEncoding.GetBytes(productCSVForEcdev.ToCharArray(), 0, productCSVForEcdev.Length, array, preamble.Length);
fileStream.Write(array, 0, array.Length);
}
using (ZipFile zipFile = new ZipFile(System.Text.Encoding.Default))
{
System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(imagePath);
zipFile.CompressionLevel = CompressionLevel.Default;
zipFile.AddFile(csvFilename, "");
zipFile.AddDirectory(directoryInfo.FullName, directoryInfo.Name);
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ContentType = "application/x-zip-compressed";
response.ContentEncoding = this._encoding;
response.AddHeader("Content-Disposition", "attachment; filename=" + directoryInfo.Name + ".zip");
response.Clear();
zipFile.Save(response.OutputStream);
this._workDir.Delete(true);
response.Flush();
response.Close();
}
}