public void AddFile(DiskReadZip_FileItemInfo file) { this.Open(); //ToDo: MemoryStream ms = new MemoryStream(file.FileData); string filefullpath = DiskReadZip_FilePacker._getFileLegalLowerDir(Path.Combine(file.FileDir, file.FileName)); this.ZipTarget.AddEntry(filefullpath, ms, true, ms.Length, file.DateTimeFromStr(file.FileUpdateTime)); }
public void AddFile(string strFileName, byte[] fileData, DateTime date) { strFileName = DiskReadZip_FilePacker._getFileLegalLowerDir(strFileName); if (string.IsNullOrEmpty(strFileName)) { throw new ArgumentNullException(strFileName); } DiskReadZip_FileItemInfo fi = new DiskReadZip_FileItemInfo(); string strFile; string strDir = GetFirstDir(strFileName, out strFile); fi.FileDir = strDir; //Path.GetDirectoryName(strFileName); fi.FileName = strFile; //Path.GetFileName(strFileName); fi.FileLen = fileData.Length; fi.FileUpdateTime = fi.DateTimeToStr(date); //.ToString("yyyy-MM-dd HH:mm"); fi.FileData = fileData; this.m_Conn = this.m_Packer.CheckConnection(this.Name); DiskReadZip_ConnectInfo conn = this.m_Conn; //conn.Insert(fi); //注意重名问题,外面判断 conn.AddFile(fi); }
public void AddFile(string strFileName, byte[] fileData, DateTime date) { strFileName = DiskReadZip_FilePacker._getFileLegalLowerDir(strFileName); if (string.IsNullOrEmpty(strFileName)) { throw new ArgumentNullException(strFileName); } DiskReadZip_FileItemInfo fi = new DiskReadZip_FileItemInfo(); string strFile; string strDir = GetFirstDir(strFileName, out strFile); fi.FileDir = strDir;//Path.GetDirectoryName(strFileName); fi.FileName = strFile;//Path.GetFileName(strFileName); fi.FileLen = fileData.Length; fi.FileUpdateTime = fi.DateTimeToStr(date);//.ToString("yyyy-MM-dd HH:mm"); fi.FileData = fileData; this.m_Conn = this.m_Packer.CheckConnection(this.Name); DiskReadZip_ConnectInfo conn = this.m_Conn; //conn.Insert(fi); //注意重名问题,外面判断 conn.AddFile(fi); }