public object addFile(ScriptContext context, object filename, object localname, object start, object length) { string fpath = Core.Convert.ObjectToString(filename); string flocal = Core.Convert.ObjectToString(localname); int fstart = Core.Convert.ObjectToInteger(start); int flength = Core.Convert.ObjectToInteger(length); try { using (PhpStream handle = PhpStream.Open(fpath, "r", StreamOpenOptions.Empty)) { if (fstart > 0) { PhpFile.Seek(handle, fstart); } FileHandleDataSource src = new FileHandleDataSource(handle, flength); this.m_zip.BeginUpdate(); this.m_zip.Add(src, flocal); this.m_zip.CommitUpdate(); return(true); } } catch (Exception ex) { Debug.WriteLine("ZipArchive::addFile", ex.Message); return(false); } }
public object addFile(ScriptContext context, object filename, object localname, object start, object length) { string fpath = Core.Convert.ObjectToString(filename); string flocal = Core.Convert.ObjectToString(localname); int fstart = Core.Convert.ObjectToInteger(start); int flength = Core.Convert.ObjectToInteger(length); try { using (PhpStream handle = PhpStream.Open(fpath, "r", StreamOpenOptions.Empty)) { if (fstart > 0) { PhpFile.Seek(handle, fstart); } FileHandleDataSource src = new FileHandleDataSource(handle, flength); this.m_zip.BeginUpdate(); this.m_zip.Add(src, flocal); this.m_zip.CommitUpdate(); return true; } } catch (Exception ex) { Debug.WriteLine("ZipArchive::addFile", ex.Message); return false; } }