public ZipEntry UpdateFile(string fileName, String directoryPathInArchive)
        {
            // ideally this would all be transactional!
            var key = ZipEntry.NameInArchive(fileName, directoryPathInArchive);

            if (this[key] != null)
            {
                this.RemoveEntry(key);
            }
            return(this.AddFile(fileName, directoryPathInArchive));
        }
        public ZipEntry AddFile(string fileName, String directoryPathInArchive)
        {
            string   nameInArchive = ZipEntry.NameInArchive(fileName, directoryPathInArchive);
            ZipEntry ze            = ZipEntry.CreateFromFile(fileName, nameInArchive);

            if (Verbose)
            {
                StatusMessageTextWriter.WriteLine("adding {0}...", fileName);
            }
            return(_InternalAddEntry(ze));
        }
        private void RemoveEntryForUpdate(string entryName)
        {
            if (String.IsNullOrEmpty(entryName))
            {
                throw new ArgumentNullException("entryName");
            }

            string directoryPathInArchive = null;

            if (entryName.IndexOf('\\') != -1)
            {
                directoryPathInArchive = Path.GetDirectoryName(entryName);
                entryName = Path.GetFileName(entryName);
            }
            var key = ZipEntry.NameInArchive(entryName, directoryPathInArchive);

            if (this[key] != null)
            {
                this.RemoveEntry(key);
            }
        }