public override byte[] GetData(string url)
 {
     // Open ZIP archive.
     using (ZipFilesHelper helper = new ZipFilesHelper(StoragePath)) {
         // Read a file with a specified URL from the archive.
         InternalZipFile zipFile = GetZipFile(helper.ZipFiles, url);
         if (zipFile != null)
         {
             return(GetBytes(zipFile));
         }
         return(new byte[] { });
     }
 }
        List <string> GetUrlsCore(Predicate <string> method)
        {
            List <string> list = new List <string>();

            using (ZipFilesHelper helper = new ZipFilesHelper(StoragePath)) {
                foreach (InternalZipFile item in helper.ZipFiles)
                {
                    if (method == null || method(item.FileName))
                    {
                        list.Add(item.FileName);
                    }
                }
                return(list);
            }
        }
        void SaveArchive(string url, byte[] buffer)
        {
            string tempPath = Path.ChangeExtension(StoragePath, "tmp");

            // Create a new ZIP archive.
            using (InternalZipArchive arch = new InternalZipArchive(tempPath)) {
                // Open a ZIP archive where report files are stored.
                using (ZipFilesHelper helper = new ZipFilesHelper(StoragePath)) {
                    bool added = false;
                    // Copy all report files to a new archive.
                    // Update a file with a specified URL.
                    // If the file does not exist, create it.
                    foreach (InternalZipFile item in helper.ZipFiles)
                    {
                        if (StringsEgual(item.FileName, url))
                        {
                            arch.Add(item.FileName, DateTime.Now, buffer);
                            added = true;
                        }
                        else
                        {
                            arch.Add(item.FileName, DateTime.Now, GetBytes(item));
                        }
                    }
                    if (!added)
                    {
                        arch.Add(url, DateTime.Now, buffer);
                    }
                }
            }
            // Replace the old ZIP archive with the new one.
            if (File.Exists(StoragePath))
            {
                File.Delete(StoragePath);
            }
            File.Move(tempPath, StoragePath);
        }