From cc3848aea5cfab5fb4f51b873dc81af84f331e77 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 20 Dec 2013 15:00:17 +0000 Subject: [PATCH] Remove write check as I never actually write to any of the read streams --- SharpCompress/Archive/AbstractWritableArchive.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/SharpCompress/Archive/AbstractWritableArchive.cs b/SharpCompress/Archive/AbstractWritableArchive.cs index 53bc9a75..7cf81902 100644 --- a/SharpCompress/Archive/AbstractWritableArchive.cs +++ b/SharpCompress/Archive/AbstractWritableArchive.cs @@ -15,7 +15,6 @@ namespace SharpCompress.Archive private readonly List modifiedEntries = new List(); private bool hasModifications; - private readonly bool anyNotWritable; internal AbstractWritableArchive(ArchiveType type) : base(type) @@ -25,10 +24,6 @@ namespace SharpCompress.Archive internal AbstractWritableArchive(ArchiveType type, Stream stream, Options options) : base(type, stream.AsEnumerable(), options) { - if (!stream.CanWrite) - { - anyNotWritable = true; - } } #if !PORTABLE && !NETFX_CORE @@ -38,14 +33,6 @@ namespace SharpCompress.Archive } #endif - private void CheckWritable() - { - if (anyNotWritable) - { - throw new ArchiveException("All Archive streams must be Writable to use Archive writing functionality."); - } - } - public override ICollection Entries { get @@ -73,7 +60,6 @@ namespace SharpCompress.Archive public void RemoveEntry(TEntry entry) { - CheckWritable(); if (!removedEntries.Contains(entry)) { removedEntries.Add(entry); @@ -84,7 +70,6 @@ namespace SharpCompress.Archive public void AddEntry(string filePath, Stream source, long size = 0, DateTime? modified = null) { - CheckWritable(); newEntries.Add(CreateEntry(filePath, source, size, modified, false)); RebuildModifiedCollection(); } @@ -92,7 +77,6 @@ namespace SharpCompress.Archive public void AddEntry(string filePath, Stream source, bool closeStream, long size = 0, DateTime? modified = null) { - CheckWritable(); newEntries.Add(CreateEntry(filePath, source, size, modified, closeStream)); RebuildModifiedCollection(); }