mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[FileTypes/] Simplify names
This commit is contained in:
@@ -27,14 +27,14 @@ namespace SabreTools.Library.FileTypes
|
||||
/// <summary>
|
||||
/// Represents a TorrentGZip archive for reading and writing
|
||||
/// </summary>
|
||||
public class TorrentGZipArchive : BaseArchive
|
||||
public class GZipArchive : BaseArchive
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a new TorrentGZipArchive with no base file
|
||||
/// </summary>
|
||||
public TorrentGZipArchive()
|
||||
public GZipArchive()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace SabreTools.Library.FileTypes
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file to use as an archive</param>
|
||||
/// <param name="read">True for opening file as read, false for opening file as write</param>
|
||||
public TorrentGZipArchive(string filename)
|
||||
public GZipArchive(string filename)
|
||||
: base(filename)
|
||||
{
|
||||
_archiveType = ArchiveType.GZip;
|
||||
@@ -17,14 +17,14 @@ namespace SabreTools.Library.FileTypes
|
||||
/// Represents a TorrentLRZip archive for reading and writing
|
||||
/// </summary>
|
||||
/// TODO: LRZIP: https://github.com/ckolivas/lrzip
|
||||
public class TorrentLRZArchive : BaseArchive
|
||||
public class LRZArchive : BaseArchive
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a new TorrentGZipArchive with no base file
|
||||
/// </summary>
|
||||
public TorrentLRZArchive()
|
||||
public LRZArchive()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
@@ -34,7 +34,7 @@ namespace SabreTools.Library.FileTypes
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file to use as an archive</param>
|
||||
/// <param name="read">True for opening file as read, false for opening file as write</param>
|
||||
public TorrentLRZArchive(string filename)
|
||||
public LRZArchive(string filename)
|
||||
: base(filename)
|
||||
{
|
||||
//_archiveType = ArchiveType.LRZip;
|
||||
@@ -27,14 +27,14 @@ namespace SabreTools.Library.FileTypes
|
||||
/// <summary>
|
||||
/// Represents a TorrentRAR archive for reading and writing
|
||||
/// </summary>
|
||||
public class TorrentRARArchive : BaseArchive
|
||||
public class RarArchive : BaseArchive
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a new TorrentRARArchive with no base file
|
||||
/// </summary>
|
||||
public TorrentRARArchive()
|
||||
public RarArchive()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace SabreTools.Library.FileTypes
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file to use as an archive</param>
|
||||
/// <param name="read">True for opening file as read, false for opening file as write</param>
|
||||
public TorrentRARArchive(string filename)
|
||||
public RarArchive(string filename)
|
||||
: base(filename)
|
||||
{
|
||||
_archiveType = ArchiveType.Rar;
|
||||
@@ -69,7 +69,7 @@ namespace SabreTools.Library.FileTypes
|
||||
Directory.CreateDirectory(outDir);
|
||||
|
||||
// Extract all files to the temp directory
|
||||
RarArchive ra = RarArchive.Open(_filename);
|
||||
SharpCompress.Archives.Rar.RarArchive ra = SharpCompress.Archives.Rar.RarArchive.Open(_filename);
|
||||
foreach (RarArchiveEntry entry in ra.Entries)
|
||||
{
|
||||
entry.WriteToDirectory(outDir, new ExtractionOptions { PreserveFileTime = true, ExtractFullPath = true, Overwrite = true });
|
||||
@@ -153,7 +153,7 @@ namespace SabreTools.Library.FileTypes
|
||||
|
||||
try
|
||||
{
|
||||
RarArchive ra = RarArchive.Open(_filename, new ReaderOptions { LeaveStreamOpen = false, });
|
||||
SharpCompress.Archives.Rar.RarArchive ra = SharpCompress.Archives.Rar.RarArchive.Open(_filename, new ReaderOptions { LeaveStreamOpen = false, });
|
||||
foreach (RarArchiveEntry entry in ra.Entries)
|
||||
{
|
||||
if (entry != null && !entry.IsDirectory && entry.Key.Contains(entryName))
|
||||
@@ -193,7 +193,7 @@ namespace SabreTools.Library.FileTypes
|
||||
|
||||
try
|
||||
{
|
||||
RarArchive ra = RarArchive.Open(FileTools.TryOpenRead(_filename));
|
||||
SharpCompress.Archives.Rar.RarArchive ra = SharpCompress.Archives.Rar.RarArchive.Open(FileTools.TryOpenRead(_filename));
|
||||
foreach (RarArchiveEntry entry in ra.Entries.Where(e => e != null && !e.IsDirectory))
|
||||
{
|
||||
// If secure hashes are disabled, do a quickscan
|
||||
@@ -246,7 +246,7 @@ namespace SabreTools.Library.FileTypes
|
||||
|
||||
try
|
||||
{
|
||||
RarArchive ra = RarArchive.Open(_filename, new ReaderOptions { LeaveStreamOpen = false });
|
||||
SharpCompress.Archives.Rar.RarArchive ra = SharpCompress.Archives.Rar.RarArchive.Open(_filename, new ReaderOptions { LeaveStreamOpen = false });
|
||||
List<RarArchiveEntry> rarEntries = ra.Entries.OrderBy(e => e.Key, new NaturalSort.NaturalReversedComparer()).ToList();
|
||||
string lastRarEntry = null;
|
||||
foreach (RarArchiveEntry entry in rarEntries)
|
||||
@@ -31,14 +31,14 @@ namespace SabreTools.Library.FileTypes
|
||||
/// Represents a Torrent7zip archive for reading and writing
|
||||
/// </summary>
|
||||
/// TODO: Torrent 7-zip: https://sourceforge.net/p/t7z/code/HEAD/tree/
|
||||
public class TorrentSevenZipArchive : BaseArchive
|
||||
public class SevenZipArchive : BaseArchive
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a new TorrentSevenZipArchive with no base file
|
||||
/// </summary>
|
||||
public TorrentSevenZipArchive()
|
||||
public SevenZipArchive()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace SabreTools.Library.FileTypes
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file to use as an archive</param>
|
||||
/// <param name="read">True for opening file as read, false for opening file as write</param>
|
||||
public TorrentSevenZipArchive(string filename)
|
||||
public SevenZipArchive(string filename)
|
||||
: base(filename)
|
||||
{
|
||||
_archiveType = ArchiveType.SevenZip;
|
||||
@@ -73,7 +73,7 @@ namespace SabreTools.Library.FileTypes
|
||||
Directory.CreateDirectory(outDir);
|
||||
|
||||
// Extract all files to the temp directory
|
||||
SevenZipArchive sza = SevenZipArchive.Open(FileTools.TryOpenRead(_filename));
|
||||
SharpCompress.Archives.SevenZip.SevenZipArchive sza = SharpCompress.Archives.SevenZip.SevenZipArchive.Open(FileTools.TryOpenRead(_filename));
|
||||
foreach (SevenZipArchiveEntry entry in sza.Entries)
|
||||
{
|
||||
entry.WriteToDirectory(outDir, new ExtractionOptions { PreserveFileTime = true, ExtractFullPath = true, Overwrite = true });
|
||||
@@ -157,7 +157,7 @@ namespace SabreTools.Library.FileTypes
|
||||
|
||||
try
|
||||
{
|
||||
SevenZipArchive sza = SevenZipArchive.Open(_filename, new ReaderOptions { LeaveStreamOpen = false, });
|
||||
SharpCompress.Archives.SevenZip.SevenZipArchive sza = SharpCompress.Archives.SevenZip.SevenZipArchive.Open(_filename, new ReaderOptions { LeaveStreamOpen = false, });
|
||||
foreach (SevenZipArchiveEntry entry in sza.Entries)
|
||||
{
|
||||
if (entry != null && !entry.IsDirectory && entry.Key.Contains(entryName))
|
||||
@@ -198,7 +198,7 @@ namespace SabreTools.Library.FileTypes
|
||||
|
||||
try
|
||||
{
|
||||
SevenZipArchive sza = SevenZipArchive.Open(FileTools.TryOpenRead(_filename));
|
||||
SharpCompress.Archives.SevenZip.SevenZipArchive sza = SharpCompress.Archives.SevenZip.SevenZipArchive.Open(FileTools.TryOpenRead(_filename));
|
||||
foreach (SevenZipArchiveEntry entry in sza.Entries.Where(e => e != null && !e.IsDirectory))
|
||||
{
|
||||
// If secure hashes are disabled, do a quickscan
|
||||
@@ -251,7 +251,7 @@ namespace SabreTools.Library.FileTypes
|
||||
|
||||
try
|
||||
{
|
||||
SevenZipArchive sza = SevenZipArchive.Open(_filename, new ReaderOptions { LeaveStreamOpen = false });
|
||||
SharpCompress.Archives.SevenZip.SevenZipArchive sza = SharpCompress.Archives.SevenZip.SevenZipArchive.Open(_filename, new ReaderOptions { LeaveStreamOpen = false });
|
||||
List<SevenZipArchiveEntry> sevenZipEntries = sza.Entries.OrderBy(e => e.Key, new NaturalSort.NaturalReversedComparer()).ToList();
|
||||
string lastSevenZipEntry = null;
|
||||
foreach (SevenZipArchiveEntry entry in sevenZipEntries)
|
||||
@@ -30,14 +30,14 @@ namespace SabreTools.Library.FileTypes
|
||||
/// Represents a Torrent7zip archive for reading and writing
|
||||
/// </summary>
|
||||
/// TODO: Don't try to read entries to MemoryStream during write
|
||||
public class TorrentTarArchive : BaseArchive
|
||||
public class TapeArchive : BaseArchive
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a new TorrentTarArchive with no base file
|
||||
/// </summary>
|
||||
public TorrentTarArchive()
|
||||
public TapeArchive()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
@@ -47,7 +47,7 @@ namespace SabreTools.Library.FileTypes
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file to use as an archive</param>
|
||||
/// <param name="read">True for opening file as read, false for opening file as write</param>
|
||||
public TorrentTarArchive(string filename)
|
||||
public TapeArchive(string filename)
|
||||
: base(filename)
|
||||
{
|
||||
_archiveType = ArchiveType.Tar;
|
||||
@@ -26,14 +26,14 @@ namespace SabreTools.Library.FileTypes
|
||||
/// Represents a TorrentXZ archive for reading and writing
|
||||
/// </summary>
|
||||
/// TODO: Wait for XZ write to be enabled by SevenZipSharp library
|
||||
public class TorrentXZArchive : BaseArchive
|
||||
public class XZArchive : BaseArchive
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a new TorrentGZipArchive with no base file
|
||||
/// </summary>
|
||||
public TorrentXZArchive()
|
||||
public XZArchive()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
@@ -43,7 +43,7 @@ namespace SabreTools.Library.FileTypes
|
||||
/// </summary>
|
||||
/// <param name="filename">Name of the file to use as an archive</param>
|
||||
/// <param name="read">True for opening file as read, false for opening file as write</param>
|
||||
public TorrentXZArchive(string filename)
|
||||
public XZArchive(string filename)
|
||||
: base(filename)
|
||||
{
|
||||
//_archiveType = ArchiveType.XZip;
|
||||
@@ -152,12 +152,12 @@
|
||||
<Compile Include="External\Zlib\ZlibStream.cs" />
|
||||
<Compile Include="FileTypes\BaseArchive.cs" />
|
||||
<Compile Include="FileTypes\Folder.cs" />
|
||||
<Compile Include="FileTypes\TorrentGZipArchive.cs" />
|
||||
<Compile Include="FileTypes\TorrentLRZArchive.cs" />
|
||||
<Compile Include="FileTypes\TorrentRARArchive.cs" />
|
||||
<Compile Include="FileTypes\TorrentSevenZipArchive.cs" />
|
||||
<Compile Include="FileTypes\TorrentTarArchive.cs" />
|
||||
<Compile Include="FileTypes\TorrentXZArchive.cs" />
|
||||
<Compile Include="FileTypes\GZipArchive.cs" />
|
||||
<Compile Include="FileTypes\LRZArchive.cs" />
|
||||
<Compile Include="FileTypes\RarArchive.cs" />
|
||||
<Compile Include="FileTypes\SevenZipArchive.cs" />
|
||||
<Compile Include="FileTypes\TapeArchive.cs" />
|
||||
<Compile Include="FileTypes\XZArchive.cs" />
|
||||
<Compile Include="FileTypes\TorrentZipArchive.cs" />
|
||||
<Compile Include="Items\Archive.cs" />
|
||||
<Compile Include="Items\BiosSet.cs" />
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using SabreTools.Library.Data;
|
||||
@@ -12,8 +11,6 @@ using System.IO;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
|
||||
using BinaryReader = System.IO.BinaryReader;
|
||||
using FileStream = System.IO.FileStream;
|
||||
using MemoryStream = System.IO.MemoryStream;
|
||||
using SeekOrigin = System.IO.SeekOrigin;
|
||||
using Stream = System.IO.Stream;
|
||||
#endif
|
||||
@@ -57,16 +54,16 @@ namespace SabreTools.Library.Tools
|
||||
switch (at)
|
||||
{
|
||||
case ArchiveType.GZip:
|
||||
archive = new TorrentGZipArchive(input);
|
||||
archive = new GZipArchive(input);
|
||||
break;
|
||||
case ArchiveType.Rar:
|
||||
archive = new TorrentRARArchive(input);
|
||||
archive = new RarArchive(input);
|
||||
break;
|
||||
case ArchiveType.SevenZip:
|
||||
archive = new TorrentSevenZipArchive(input);
|
||||
archive = new SevenZipArchive(input);
|
||||
break;
|
||||
case ArchiveType.Tar:
|
||||
archive = new TorrentTarArchive(input);
|
||||
archive = new TapeArchive(input);
|
||||
break;
|
||||
case ArchiveType.Zip:
|
||||
archive = new TorrentZipArchive(input);
|
||||
@@ -86,13 +83,13 @@ namespace SabreTools.Library.Tools
|
||||
switch(archiveType)
|
||||
{
|
||||
case ArchiveType.GZip:
|
||||
return new TorrentGZipArchive();
|
||||
return new GZipArchive();
|
||||
case ArchiveType.Rar:
|
||||
return new TorrentRARArchive();
|
||||
return new RarArchive();
|
||||
case ArchiveType.SevenZip:
|
||||
return new TorrentSevenZipArchive();
|
||||
return new SevenZipArchive();
|
||||
case ArchiveType.Tar:
|
||||
return new TorrentTarArchive();
|
||||
return new TapeArchive();
|
||||
case ArchiveType.Zip:
|
||||
return new TorrentZipArchive();
|
||||
default:
|
||||
@@ -112,17 +109,17 @@ namespace SabreTools.Library.Tools
|
||||
case OutputFormat.Folder:
|
||||
return new Folder();
|
||||
case OutputFormat.TapeArchive:
|
||||
return new TorrentTarArchive();
|
||||
return new TapeArchive();
|
||||
case OutputFormat.Torrent7Zip:
|
||||
return new TorrentSevenZipArchive();
|
||||
return new SevenZipArchive();
|
||||
case OutputFormat.TorrentGzip:
|
||||
return new TorrentGZipArchive();
|
||||
return new GZipArchive();
|
||||
case OutputFormat.TorrentLrzip:
|
||||
return new TorrentLRZArchive();
|
||||
return new LRZArchive();
|
||||
case OutputFormat.TorrentRar:
|
||||
return new TorrentRARArchive();
|
||||
return new RarArchive();
|
||||
case OutputFormat.TorrentXZ:
|
||||
return new TorrentXZArchive();
|
||||
return new XZArchive();
|
||||
case OutputFormat.TorrentZip:
|
||||
return new TorrentZipArchive();
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user