Index: UnZip.cpp =================================================================== --- UnZip.cpp (revision 11053) +++ UnZip.cpp (working copy) @@ -40,7 +40,7 @@ for(int i = 0; i < entries; i++) { if(zip->Get32le() != 0x02014b50 && zip->IsEof()) return; - File& f = file.Add(); + File f; zip->Get16le(); zip->Get16le(); f.bit = zip->Get16le(); // general purpose bit flag @@ -58,6 +58,7 @@ zip->Get32le(); // external file attributes f.offset = zip->Get32le(); f.path = zip->Get(fnlen); + file.Add(f); zip->SeekCur(extralen + commentlen); if(zip->IsEof() || zip->IsError()) return; @@ -141,6 +142,35 @@ return ReadFile(ss, progress) ? ss.GetResult() : String::GetVoid(); } +String UnZip::ReadFile(const char* path, Gate progress) +{ + for(int i = 0; i < file.GetCount(); i++) + { + if(file[i].path.IsEqual(path)) + { + Seek(i); + return ReadFile( progress ); + } + } + + return String::GetVoid(); +} + +Vector UnZip::Search(String pattern) +{ + Vector v; + for(const auto& f: file) + { + if(!f.path.EndsWith("/") && PatternMatch(pattern, f.path)) + { + v.Add(f.path); + } + } + + return v; +} + + void UnZip::Create(Stream& _zip) { zip = &_zip; Index: zip.h =================================================================== --- zip.h (revision 11053) +++ zip.h (working copy) @@ -50,6 +50,8 @@ void SkipFile() { current++; } bool ReadFile(Stream& out, Gate progress = Null); String ReadFile(Gate progress = Null); + String ReadFile(const char* path, Gate progress = Null); + Vector Search(String pattern); dword GetPos() const;