protected override IVirtualFile AddFileToBackingDirectoryOrDefault(string fileName, byte[] contents) { var file = this.Files.FirstOrDefault(d => d.Name == fileName); if (file != null) { throw new ArgumentException("A file with the same name already exists"); } var virtualPath = Provider.CombineVirtualPath(this.VirtualPath, fileName); var zipPath = GetZipPath(virtualPath, false); var newEntry = Provider.Zip.AddEntry(zipPath, contents); Provider.Save(); return(new ZipVirtualFile(Provider, newEntry, this)); }
private void ReplaceBytes(byte[] data) { Provider.Zip.UpdateEntry(this.VirtualPath.Substring(1), data); Provider.Save(); this.Entry = Provider.Zip.Entries.First(e => e.FileName == Entry.FileName); }