diff --git a/SharpCompress.Test/ArchiveTests.cs b/SharpCompress.Test/ArchiveTests.cs index 903df7d1..526e17ec 100644 --- a/SharpCompress.Test/ArchiveTests.cs +++ b/SharpCompress.Test/ArchiveTests.cs @@ -120,7 +120,7 @@ namespace SharpCompress.Test void archive_EntryExtractionBegin(object sender, ArchiveExtractionEventArgs e) { this.entryTotal = e.Item.Size; - Console.WriteLine("Initializing File Entry Extraction: " + e.Item.FilePath); + Console.WriteLine("Initializing File Entry Extraction: " + e.Item.Key); } private long? entryTotal; diff --git a/SharpCompress.Test/GZip/GZipArchiveTests.cs b/SharpCompress.Test/GZip/GZipArchiveTests.cs index c98f90d1..8a8e26ee 100644 --- a/SharpCompress.Test/GZip/GZipArchiveTests.cs +++ b/SharpCompress.Test/GZip/GZipArchiveTests.cs @@ -23,7 +23,7 @@ namespace SharpCompress.Test using (var archive = ArchiveFactory.Open(stream)) { var entry = archive.Entries.First(); - entry.WriteToFile(Path.Combine(SCRATCH_FILES_PATH, entry.FilePath)); + entry.WriteToFile(Path.Combine(SCRATCH_FILES_PATH, entry.Key)); } CompareArchivesByPath(Path.Combine(SCRATCH_FILES_PATH, "Tar.tar"), Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar")); @@ -37,7 +37,7 @@ namespace SharpCompress.Test using (var archive = GZipArchive.Open(stream)) { var entry = archive.Entries.First(); - entry.WriteToFile(Path.Combine(SCRATCH_FILES_PATH, entry.FilePath)); + entry.WriteToFile(Path.Combine(SCRATCH_FILES_PATH, entry.Key)); } CompareArchivesByPath(Path.Combine(SCRATCH_FILES_PATH, "Tar.tar"), Path.Combine(TEST_ARCHIVES_PATH, "Tar.tar")); diff --git a/SharpCompress.Test/Rar/RarReaderTests.cs b/SharpCompress.Test/Rar/RarReaderTests.cs index b9fda666..8f4609c2 100644 --- a/SharpCompress.Test/Rar/RarReaderTests.cs +++ b/SharpCompress.Test/Rar/RarReaderTests.cs @@ -135,8 +135,8 @@ namespace SharpCompress.Test Assert.AreEqual(reader.Entry.CompressionType, CompressionType.Rar); using (var entryStream = reader.OpenEntryStream()) { - string file = Path.GetFileName(reader.Entry.FilePath); - string folder = Path.GetDirectoryName(reader.Entry.FilePath); + string file = Path.GetFileName(reader.Entry.Key); + string folder = Path.GetDirectoryName(reader.Entry.Key); string destdir = Path.Combine(SCRATCH_FILES_PATH, folder); if (!Directory.Exists(destdir)) { @@ -203,7 +203,7 @@ namespace SharpCompress.Test { while (reader.MoveToNextEntry()) { - if (reader.Entry.FilePath.Contains("jpg")) + if (reader.Entry.Key.Contains("jpg")) { Assert.AreEqual(reader.Entry.CompressionType, CompressionType.Rar); reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite); @@ -221,7 +221,7 @@ namespace SharpCompress.Test { while (reader.MoveToNextEntry()) { - if (reader.Entry.FilePath.Contains("jpg")) + if (reader.Entry.Key.Contains("jpg")) { Assert.AreEqual(reader.Entry.CompressionType, CompressionType.Rar); reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite); diff --git a/SharpCompress.Test/Tar/TarArchiveTests.cs b/SharpCompress.Test/Tar/TarArchiveTests.cs index dc4bf1d6..259122c8 100644 --- a/SharpCompress.Test/Tar/TarArchiveTests.cs +++ b/SharpCompress.Test/Tar/TarArchiveTests.cs @@ -36,7 +36,7 @@ namespace SharpCompress.Test using (var archive = TarArchive.Open(unmodified)) { Assert.AreEqual(2, archive.Entries.Count); - Assert.AreEqual(archive.Entries.Last().FilePath, @"very long filename/very long filename very long filename very long filename very long filename very long filename very long filename very long filename very long filename very long filename very long filename.jpg"); + Assert.AreEqual(archive.Entries.Last().Key, @"very long filename/very long filename very long filename very long filename very long filename very long filename very long filename very long filename very long filename very long filename very long filename.jpg"); } } @@ -81,7 +81,7 @@ namespace SharpCompress.Test base.ResetScratch(); using (var archive = TarArchive.Open(unmodified)) { - var entry = archive.Entries.Where(x => x.FilePath.EndsWith("jpg")).Single(); + var entry = archive.Entries.Where(x => x.Key.EndsWith("jpg")).Single(); archive.RemoveEntry(entry); archive.SaveTo(scratchPath, CompressionType.None); } diff --git a/SharpCompress.Test/Tar/TarReaderTests.cs b/SharpCompress.Test/Tar/TarReaderTests.cs index 95f3475d..69963df5 100644 --- a/SharpCompress.Test/Tar/TarReaderTests.cs +++ b/SharpCompress.Test/Tar/TarReaderTests.cs @@ -46,8 +46,8 @@ namespace SharpCompress.Test Assert.AreEqual(reader.Entry.CompressionType, CompressionType.BZip2); using (var entryStream = reader.OpenEntryStream()) { - string file = Path.GetFileName(reader.Entry.FilePath); - string folder = Path.GetDirectoryName(reader.Entry.FilePath); + string file = Path.GetFileName(reader.Entry.Key); + string folder = Path.GetDirectoryName(reader.Entry.Key); string destdir = Path.Combine(SCRATCH_FILES_PATH, folder); if (!Directory.Exists(destdir)) { @@ -81,7 +81,7 @@ namespace SharpCompress.Test using (var entryStream = reader.OpenEntryStream()) { entryStream.SkipEntry(); - names.Add(reader.Entry.FilePath); + names.Add(reader.Entry.Key); } } } diff --git a/SharpCompress.Test/TestBase.cs b/SharpCompress.Test/TestBase.cs index cf845da3..bfdda059 100644 --- a/SharpCompress.Test/TestBase.cs +++ b/SharpCompress.Test/TestBase.cs @@ -144,7 +144,7 @@ namespace SharpCompress.Test while (archive1.MoveToNextEntry()) { Assert.IsTrue(archive2.MoveToNextEntry()); - Assert.AreEqual(archive1.Entry.FilePath, archive2.Entry.FilePath); + Assert.AreEqual(archive1.Entry.Key, archive2.Entry.Key); } Assert.IsFalse(archive2.MoveToNextEntry()); } diff --git a/SharpCompress.Test/Zip/ZipArchiveTests.cs b/SharpCompress.Test/Zip/ZipArchiveTests.cs index c0f1f328..33fd7861 100644 --- a/SharpCompress.Test/Zip/ZipArchiveTests.cs +++ b/SharpCompress.Test/Zip/ZipArchiveTests.cs @@ -140,7 +140,7 @@ namespace SharpCompress.Test base.ResetScratch(); using (var archive = ZipArchive.Open(unmodified)) { - var entry = archive.Entries.Single(x => x.FilePath.EndsWith("jpg")); + var entry = archive.Entries.Single(x => x.Key.EndsWith("jpg")); archive.RemoveEntry(entry); archive.SaveTo(scratchPath, CompressionType.Deflate); } @@ -194,10 +194,10 @@ namespace SharpCompress.Test using (ZipArchive vfs = (ZipArchive)ArchiveFactory.Open(scratchPath)) { - var e = vfs.Entries.First(v => v.FilePath.EndsWith("jpg")); + var e = vfs.Entries.First(v => v.Key.EndsWith("jpg")); vfs.RemoveEntry(e); - Assert.IsNull(vfs.Entries.FirstOrDefault(v => v.FilePath.EndsWith("jpg"))); - Assert.IsNull(((IArchive)vfs).Entries.FirstOrDefault(v => v.FilePath.EndsWith("jpg"))); + Assert.IsNull(vfs.Entries.FirstOrDefault(v => v.Key.EndsWith("jpg"))); + Assert.IsNull(((IArchive)vfs).Entries.FirstOrDefault(v => v.Key.EndsWith("jpg"))); } } @@ -287,8 +287,8 @@ namespace SharpCompress.Test using (var archive = ZipArchive.Create()) { archive.AddAllFromDirectory(SCRATCH_FILES_PATH); - archive.RemoveEntry(archive.Entries.Single(x => x.FilePath.EndsWith("jpg", StringComparison.OrdinalIgnoreCase))); - Assert.IsFalse(archive.Entries.Any(x => x.FilePath.EndsWith("jpg"))); + archive.RemoveEntry(archive.Entries.Single(x => x.Key.EndsWith("jpg", StringComparison.OrdinalIgnoreCase))); + Assert.IsFalse(archive.Entries.Any(x => x.Key.EndsWith("jpg"))); } Directory.Delete(SCRATCH_FILES_PATH, true); } diff --git a/SharpCompress/Archive/AbstractWritableArchive.cs b/SharpCompress/Archive/AbstractWritableArchive.cs index 194c6873..49c553ed 100644 --- a/SharpCompress/Archive/AbstractWritableArchive.cs +++ b/SharpCompress/Archive/AbstractWritableArchive.cs @@ -93,7 +93,7 @@ namespace SharpCompress.Archive private bool DoesKeyMatchExisting(string key) { - foreach (var path in Entries.Select(x => x.FilePath)) + foreach (var path in Entries.Select(x => x.Key)) { var p = path.Replace('/','\\'); if (p.StartsWith("\\")) diff --git a/SharpCompress/Archive/GZip/GZipArchive.cs b/SharpCompress/Archive/GZip/GZipArchive.cs index 7c8e0c5f..07e0ffea 100644 --- a/SharpCompress/Archive/GZip/GZipArchive.cs +++ b/SharpCompress/Archive/GZip/GZipArchive.cs @@ -186,7 +186,7 @@ namespace SharpCompress.Archive.GZip { using (var entryStream = entry.OpenEntryStream()) { - writer.Write(entry.FilePath, entryStream, entry.LastModifiedTime); + writer.Write(entry.Key, entryStream, entry.LastModifiedTime); } } } diff --git a/SharpCompress/Archive/GZip/GZipWritableArchiveEntry.cs b/SharpCompress/Archive/GZip/GZipWritableArchiveEntry.cs index 5ada4f47..d11a000f 100644 --- a/SharpCompress/Archive/GZip/GZipWritableArchiveEntry.cs +++ b/SharpCompress/Archive/GZip/GZipWritableArchiveEntry.cs @@ -30,7 +30,7 @@ namespace SharpCompress.Archive.GZip get { return 0; } } - public override string FilePath + public override string Key { get { return path; } } diff --git a/SharpCompress/Archive/IArchiveEntry.Extensions.cs b/SharpCompress/Archive/IArchiveEntry.Extensions.cs index 7ad934c3..e1c549c6 100644 --- a/SharpCompress/Archive/IArchiveEntry.Extensions.cs +++ b/SharpCompress/Archive/IArchiveEntry.Extensions.cs @@ -21,7 +21,7 @@ namespace SharpCompress.Archive var streamListener = archiveEntry.Archive as IArchiveExtractionListener; streamListener.EnsureEntriesLoaded(); streamListener.FireEntryExtractionBegin(archiveEntry); - streamListener.FireFilePartExtractionBegin(archiveEntry.FilePath, archiveEntry.Size, archiveEntry.CompressedSize); + streamListener.FireFilePartExtractionBegin(archiveEntry.Key, archiveEntry.Size, archiveEntry.CompressedSize); using (Stream s = new ListeningStream(streamListener, archiveEntry.OpenEntryStream())) { s.TransferTo(streamToWriteTo); @@ -37,12 +37,12 @@ namespace SharpCompress.Archive ExtractOptions options = ExtractOptions.Overwrite) { string destinationFileName; - string file = Path.GetFileName(entry.FilePath); + string file = Path.GetFileName(entry.Key); if (options.HasFlag(ExtractOptions.ExtractFullPath)) { - string folder = Path.GetDirectoryName(entry.FilePath); + string folder = Path.GetDirectoryName(entry.Key); string destdir = Path.Combine(destinationDirectory, folder); if (!Directory.Exists(destdir)) { diff --git a/SharpCompress/Archive/Tar/TarArchive.cs b/SharpCompress/Archive/Tar/TarArchive.cs index 0fa86ccb..e801854b 100644 --- a/SharpCompress/Archive/Tar/TarArchive.cs +++ b/SharpCompress/Archive/Tar/TarArchive.cs @@ -205,7 +205,7 @@ namespace SharpCompress.Archive.Tar { using (var entryStream = entry.OpenEntryStream()) { - writer.Write(entry.FilePath, entryStream, entry.LastModifiedTime, entry.Size); + writer.Write(entry.Key, entryStream, entry.LastModifiedTime, entry.Size); } } } diff --git a/SharpCompress/Archive/Tar/TarWritableArchiveEntry.cs b/SharpCompress/Archive/Tar/TarWritableArchiveEntry.cs index 657df41b..4bb46dcb 100644 --- a/SharpCompress/Archive/Tar/TarWritableArchiveEntry.cs +++ b/SharpCompress/Archive/Tar/TarWritableArchiveEntry.cs @@ -30,7 +30,7 @@ namespace SharpCompress.Archive.Tar get { return 0; } } - public override string FilePath + public override string Key { get { return path; } } diff --git a/SharpCompress/Archive/Zip/ZipArchive.cs b/SharpCompress/Archive/Zip/ZipArchive.cs index e309a551..77bf436a 100644 --- a/SharpCompress/Archive/Zip/ZipArchive.cs +++ b/SharpCompress/Archive/Zip/ZipArchive.cs @@ -218,7 +218,7 @@ namespace SharpCompress.Archive.Zip { using (var entryStream = entry.OpenEntryStream()) { - writer.Write(entry.FilePath, entryStream, entry.LastModifiedTime, string.Empty); + writer.Write(entry.Key, entryStream, entry.LastModifiedTime, string.Empty); } } } diff --git a/SharpCompress/Archive/Zip/ZipWritableArchiveEntry.cs b/SharpCompress/Archive/Zip/ZipWritableArchiveEntry.cs index 2051c057..82a47a8e 100644 --- a/SharpCompress/Archive/Zip/ZipWritableArchiveEntry.cs +++ b/SharpCompress/Archive/Zip/ZipWritableArchiveEntry.cs @@ -31,7 +31,7 @@ namespace SharpCompress.Archive.Zip get { return 0; } } - public override string FilePath + public override string Key { get { return path; } } diff --git a/SharpCompress/Common/Entry.cs b/SharpCompress/Common/Entry.cs index 6127bc7e..27c45198 100644 --- a/SharpCompress/Common/Entry.cs +++ b/SharpCompress/Common/Entry.cs @@ -5,17 +5,15 @@ namespace SharpCompress.Common { public abstract class Entry : IEntry { - internal bool IsSolid { get; set; } - /// /// The File's 32 bit CRC Hash /// public abstract uint Crc { get; } /// - /// The path of the file internal to the Rar Archive. + /// The string key of the file internal to the Archive. /// - public abstract string FilePath { get; } + public abstract string Key { get; } /// /// The compressed file size @@ -62,9 +60,13 @@ namespace SharpCompress.Common /// public abstract bool IsDirectory { get; } + /// + /// Entry is split among multiple volumes + /// public abstract bool IsSplit { get; } internal abstract IEnumerable Parts { get; } + internal bool IsSolid { get; set; } internal virtual void Close() { diff --git a/SharpCompress/Common/GZip/GZipEntry.cs b/SharpCompress/Common/GZip/GZipEntry.cs index ddc0eec1..e5a0c4fc 100644 --- a/SharpCompress/Common/GZip/GZipEntry.cs +++ b/SharpCompress/Common/GZip/GZipEntry.cs @@ -23,7 +23,7 @@ namespace SharpCompress.Common.GZip get { return 0; } } - public override string FilePath + public override string Key { get { return filePart.FilePartName; } } diff --git a/SharpCompress/Common/IEntry.cs b/SharpCompress/Common/IEntry.cs index 78080e0c..73df8aac 100644 --- a/SharpCompress/Common/IEntry.cs +++ b/SharpCompress/Common/IEntry.cs @@ -9,7 +9,7 @@ namespace SharpCompress.Common long CompressedSize { get; } uint Crc { get; } DateTime? CreatedTime { get; } - string FilePath { get; } + string Key { get; } bool IsDirectory { get; } bool IsEncrypted { get; } bool IsSplit { get; } diff --git a/SharpCompress/Common/Rar/RarEntry.cs b/SharpCompress/Common/Rar/RarEntry.cs index 61736680..55fe71a8 100644 --- a/SharpCompress/Common/Rar/RarEntry.cs +++ b/SharpCompress/Common/Rar/RarEntry.cs @@ -18,7 +18,7 @@ namespace SharpCompress.Common.Rar /// /// The path of the file internal to the Rar Archive. /// - public override string FilePath + public override string Key { get { return FileHeader.FileName; } } @@ -79,7 +79,7 @@ namespace SharpCompress.Common.Rar public override string ToString() { return string.Format("Entry Path: {0} Compressed Size: {1} Uncompressed Size: {2} CRC: {3}", - FilePath, CompressedSize, Size, Crc); + Key, CompressedSize, Size, Crc); } } } \ No newline at end of file diff --git a/SharpCompress/Common/SevenZip/SevenZipEntry.cs b/SharpCompress/Common/SevenZip/SevenZipEntry.cs index 9403123f..e70e949b 100644 --- a/SharpCompress/Common/SevenZip/SevenZipEntry.cs +++ b/SharpCompress/Common/SevenZip/SevenZipEntry.cs @@ -22,7 +22,7 @@ namespace SharpCompress.Common.SevenZip get { return FilePart.Header.Crc ?? 0; } } - public override string FilePath + public override string Key { get { return FilePart.Header.Name; } } diff --git a/SharpCompress/Common/Tar/TarEntry.cs b/SharpCompress/Common/Tar/TarEntry.cs index 2a7c048a..7566915d 100644 --- a/SharpCompress/Common/Tar/TarEntry.cs +++ b/SharpCompress/Common/Tar/TarEntry.cs @@ -27,7 +27,7 @@ namespace SharpCompress.Common.Tar get { return 0; } } - public override string FilePath + public override string Key { get { return filePart.Header.Name; } } diff --git a/SharpCompress/Common/Zip/ZipEntry.cs b/SharpCompress/Common/Zip/ZipEntry.cs index 5054639a..51b9d7e3 100644 --- a/SharpCompress/Common/Zip/ZipEntry.cs +++ b/SharpCompress/Common/Zip/ZipEntry.cs @@ -58,7 +58,7 @@ namespace SharpCompress.Common.Zip get { return filePart.Header.Crc; } } - public override string FilePath + public override string Key { get { return filePart.Header.Name; } } diff --git a/SharpCompress/Reader/AbstractReader.cs b/SharpCompress/Reader/AbstractReader.cs index df9d9145..1340cdfa 100644 --- a/SharpCompress/Reader/AbstractReader.cs +++ b/SharpCompress/Reader/AbstractReader.cs @@ -92,7 +92,7 @@ namespace SharpCompress.Reader if ((stream == null) || (!stream.CanRead)) { throw new MultipartStreamRequiredException("File is split into multiple archives: '" - + Entry.FilePath + + + Entry.Key + "'. A new readable stream is required. Use Cancel if it was intended."); } entriesForCurrentReadStream = GetEntries(stream).GetEnumerator(); diff --git a/SharpCompress/Reader/IReader.Extensions.cs b/SharpCompress/Reader/IReader.Extensions.cs index 34fe4d29..7eabd7fc 100644 --- a/SharpCompress/Reader/IReader.Extensions.cs +++ b/SharpCompress/Reader/IReader.Extensions.cs @@ -41,12 +41,12 @@ namespace SharpCompress.Reader ExtractOptions options = ExtractOptions.Overwrite) { string destinationFileName = string.Empty; - string file = Path.GetFileName(reader.Entry.FilePath); + string file = Path.GetFileName(reader.Entry.Key); if (options.HasFlag(ExtractOptions.ExtractFullPath)) { - string folder = Path.GetDirectoryName(reader.Entry.FilePath); + string folder = Path.GetDirectoryName(reader.Entry.Key); string destdir = Path.Combine(destinationDirectory, folder); if (!Directory.Exists(destdir)) {