bool nuiZipWriter::AddFile(nglIStream* pStream, const nglString& rPathInZip, const nglString& rComment, bool OwnStream) { NGL_ASSERT(IsValid()); zip_fileinfo info; nglTime tm; nglTimeInfo t; tm.GetLocalTime(t); info.tmz_date.tm_sec = t.Seconds; info.tmz_date.tm_min = t.Minutes; info.tmz_date.tm_hour = t.Hours; info.tmz_date.tm_mday = t.Day; info.tmz_date.tm_mon = t.Month; info.tmz_date.tm_year = t.Year; info.dosDate = 0; info.internal_fa = 0; info.external_fa = 0; bool res = zipOpenNewFileInZip(mpZip, rPathInZip.IsNull() ? NULL : rPathInZip.GetStdString().c_str(), &info, NULL, 0, NULL, 0, rComment.IsNull() ? NULL : rComment.GetStdString().c_str(), 0, 0) == Z_OK; if (!res) return res; const uint32 bufsize = 4096; uint8 buf[bufsize]; uint64 todo = pStream->Available(); uint32 _read = -1; while (todo && _read) { uint32 toread = MIN(todo, bufsize); _read = pStream->Read(buf, toread, 1); res = zipWriteInFileInZip(mpZip, buf, _read) == Z_OK; todo -= _read; if (_read != toread) return false; } res = zipCloseFileInZip(mpZip) == Z_OK; if (OwnStream) delete pStream; return res; }
void nuiSWF::SetFrame(const nglString& rName) { NGL_ASSERT(mpMovie && mpMovieInterface); std::string tmp(rName.GetStdString()); mpMovieInterface->goto_labeled_frame(tmp.c_str()); }
//class nuiClass: nuiClass::nuiClass(const nglString& rName) { mName = rName; mCName = rName.GetStdString(); }
bool nuiZipWriter::Close(const nglString& rComment) { NGL_ASSERT(mpZip); return Z_OK == zipClose(mpZip, rComment.IsNull() ? NULL : rComment.GetStdString().c_str()); mpZip = NULL; }