不作详述
public void getAll(string filePath)
{
string filename = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString();
string strReturn = @"E:/work/";
filePath = @"E:\work\test\" + filename+".zip";
using (Zip zip = new Zip(filePath, Zip.CompressionLevel.Default))
{
zip.AppendDirectory("E:\\work\\test\\img");
zip.AppendString(Downloader.DownloadPicture("\\img.jpg", "", 200), Zip.CombinEntry("img", filename + ".jpg"));
}
Response.Write(strReturn);
}
public static byte[] DownloadPicture(string picUrl, string savePath, int timeOut)
{
//bool value = false;
WebResponse response = null;
Stream inStream = null;
Stream outStream = null;
byte[] buffer = new byte[1024];
string resultCode = "";
try
{
WebClient mywebclient = new WebClient();
string url = "_\\upload_img.jpg";
string newfilename = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + ".jpg";
string filepath = @"F:\" + newfilename;
try
{
buffer = mywebclient.DownloadData(url);
}
catch (Exception ex)
{
//MessageBox.Show(ex.ToString());
}
return buffer;
}
finally
{
if (response != null) response.Close();
}
}