🎨REFACTOR: Plugins do not need to expose their methods as virtual.

This commit is contained in:
2017-12-26 07:28:40 +00:00
parent 6aee3c9cb1
commit 94d8173b3a
168 changed files with 2161 additions and 2161 deletions

View File

@@ -68,65 +68,65 @@ namespace DiscImageChef.Filters
bool opened;
AppleDoubleEntry rsrcFork;
public virtual string Name => "AppleDouble";
public virtual Guid Id => new Guid("1B2165EE-C9DF-4B21-BBBB-9E5892B2DF4D");
public string Name => "AppleDouble";
public Guid Id => new Guid("1B2165EE-C9DF-4B21-BBBB-9E5892B2DF4D");
public virtual void Close()
public void Close()
{
opened = false;
}
public virtual string GetBasePath()
public string GetBasePath()
{
return basePath;
}
public virtual DateTime GetCreationTime()
public DateTime GetCreationTime()
{
return creationTime;
}
public virtual long GetDataForkLength()
public long GetDataForkLength()
{
return dataFork.length;
}
public virtual Stream GetDataForkStream()
public Stream GetDataForkStream()
{
return new FileStream(basePath, FileMode.Open, FileAccess.Read);
}
public virtual string GetFilename()
public string GetFilename()
{
return Path.GetFileName(basePath);
}
public virtual DateTime GetLastWriteTime()
public DateTime GetLastWriteTime()
{
return lastWriteTime;
}
public virtual long GetLength()
public long GetLength()
{
return dataFork.length + rsrcFork.length;
}
public virtual string GetParentFolder()
public string GetParentFolder()
{
return Path.GetDirectoryName(basePath);
}
public virtual string GetPath()
public string GetPath()
{
return basePath;
}
public virtual long GetResourceForkLength()
public long GetResourceForkLength()
{
return rsrcFork.length;
}
public virtual Stream GetResourceForkStream()
public Stream GetResourceForkStream()
{
if(rsrcFork.length == 0) return null;
@@ -134,24 +134,24 @@ namespace DiscImageChef.Filters
rsrcFork.offset + rsrcFork.length - 1);
}
public virtual bool HasResourceFork()
public bool HasResourceFork()
{
return rsrcFork.length > 0;
}
public virtual bool Identify(byte[] buffer)
public bool Identify(byte[] buffer)
{
// Now way to have two files in a single byte array
return false;
}
public virtual bool Identify(Stream stream)
public bool Identify(Stream stream)
{
// Now way to have two files in a single stream
return false;
}
public virtual bool Identify(string path)
public bool Identify(string path)
{
// Prepend data fork name with "R."
string ProDosAppleDouble;
@@ -303,24 +303,24 @@ namespace DiscImageChef.Filters
(header.version == AppleDoubleVersion || header.version == AppleDoubleVersion2);
}
public virtual bool IsOpened()
public bool IsOpened()
{
return opened;
}
public virtual void Open(byte[] buffer)
public void Open(byte[] buffer)
{
// Now way to have two files in a single byte array
throw new NotSupportedException();
}
public virtual void Open(Stream stream)
public void Open(Stream stream)
{
// Now way to have two files in a single stream
throw new NotSupportedException();
}
public virtual void Open(string path)
public void Open(string path)
{
// Prepend data fork name with "R."
string ProDosAppleDouble;

View File

@@ -69,10 +69,10 @@ namespace DiscImageChef.Filters
AppleSingleEntry rsrcFork;
Stream stream;
public virtual string Name => "AppleSingle";
public virtual Guid Id => new Guid("A69B20E8-F4D3-42BB-BD2B-4A7263394A05");
public string Name => "AppleSingle";
public Guid Id => new Guid("A69B20E8-F4D3-42BB-BD2B-4A7263394A05");
public virtual void Close()
public void Close()
{
bytes = null;
stream?.Close();
@@ -82,22 +82,22 @@ namespace DiscImageChef.Filters
opened = false;
}
public virtual string GetBasePath()
public string GetBasePath()
{
return basePath;
}
public virtual DateTime GetCreationTime()
public DateTime GetCreationTime()
{
return creationTime;
}
public virtual long GetDataForkLength()
public long GetDataForkLength()
{
return dataFork.length;
}
public virtual Stream GetDataForkStream()
public Stream GetDataForkStream()
{
if(dataFork.length == 0) return null;
@@ -110,37 +110,37 @@ namespace DiscImageChef.Filters
return null;
}
public virtual string GetFilename()
public string GetFilename()
{
return Path.GetFileName(basePath);
}
public virtual DateTime GetLastWriteTime()
public DateTime GetLastWriteTime()
{
return lastWriteTime;
}
public virtual long GetLength()
public long GetLength()
{
return dataFork.length + rsrcFork.length;
}
public virtual string GetParentFolder()
public string GetParentFolder()
{
return Path.GetDirectoryName(basePath);
}
public virtual string GetPath()
public string GetPath()
{
return basePath;
}
public virtual long GetResourceForkLength()
public long GetResourceForkLength()
{
return rsrcFork.length;
}
public virtual Stream GetResourceForkStream()
public Stream GetResourceForkStream()
{
if(rsrcFork.length == 0) return null;
@@ -153,12 +153,12 @@ namespace DiscImageChef.Filters
return null;
}
public virtual bool HasResourceFork()
public bool HasResourceFork()
{
return rsrcFork.length > 0;
}
public virtual bool Identify(byte[] buffer)
public bool Identify(byte[] buffer)
{
if(buffer == null || buffer.Length < 26) return false;
@@ -170,7 +170,7 @@ namespace DiscImageChef.Filters
(header.version == AppleSingleVersion || header.version == AppleSingleVersion2);
}
public virtual bool Identify(Stream stream)
public bool Identify(Stream stream)
{
if(stream == null || stream.Length < 26) return false;
@@ -183,7 +183,7 @@ namespace DiscImageChef.Filters
(header.version == AppleSingleVersion || header.version == AppleSingleVersion2);
}
public virtual bool Identify(string path)
public bool Identify(string path)
{
FileStream fstream = new FileStream(path, FileMode.Open, FileAccess.Read);
if(fstream.Length < 26) return false;
@@ -197,12 +197,12 @@ namespace DiscImageChef.Filters
(header.version == AppleSingleVersion || header.version == AppleSingleVersion2);
}
public virtual bool IsOpened()
public bool IsOpened()
{
return opened;
}
public virtual void Open(byte[] buffer)
public void Open(byte[] buffer)
{
MemoryStream ms = new MemoryStream(buffer);
ms.Seek(0, SeekOrigin.Begin);
@@ -280,7 +280,7 @@ namespace DiscImageChef.Filters
bytes = buffer;
}
public virtual void Open(Stream stream)
public void Open(Stream stream)
{
stream.Seek(0, SeekOrigin.Begin);
@@ -357,7 +357,7 @@ namespace DiscImageChef.Filters
this.stream = stream;
}
public virtual void Open(string path)
public void Open(string path)
{
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
fs.Seek(0, SeekOrigin.Begin);

View File

@@ -50,10 +50,10 @@ namespace DiscImageChef.Filters
DateTime lastWriteTime;
bool opened;
public virtual string Name => "BZip2";
public virtual Guid Id => new Guid("FCCFB0C3-32EF-40D8-9714-2333F6AC72A9");
public string Name => "BZip2";
public Guid Id => new Guid("FCCFB0C3-32EF-40D8-9714-2333F6AC72A9");
public virtual void Close()
public void Close()
{
dataStream?.Close();
dataStream = null;
@@ -61,32 +61,32 @@ namespace DiscImageChef.Filters
opened = false;
}
public virtual string GetBasePath()
public string GetBasePath()
{
return basePath;
}
public virtual Stream GetDataForkStream()
public Stream GetDataForkStream()
{
return innerStream;
}
public virtual string GetPath()
public string GetPath()
{
return basePath;
}
public virtual Stream GetResourceForkStream()
public Stream GetResourceForkStream()
{
return null;
}
public virtual bool HasResourceFork()
public bool HasResourceFork()
{
return false;
}
public virtual bool Identify(byte[] buffer)
public bool Identify(byte[] buffer)
{
if(buffer[0] != 0x42 || buffer[1] != 0x5A || buffer[2] != 0x68 || buffer[3] < 0x31 ||
buffer[3] > 0x39) return false;
@@ -97,7 +97,7 @@ namespace DiscImageChef.Filters
buffer[buffer.Length - 510] != 0x6C || buffer[buffer.Length - 509] != 0x79;
}
public virtual bool Identify(Stream stream)
public bool Identify(Stream stream)
{
byte[] buffer = new byte[4];
@@ -117,7 +117,7 @@ namespace DiscImageChef.Filters
return buffer[0] != 0x6B || buffer[1] != 0x6F || buffer[2] != 0x6C || buffer[3] != 0x79;
}
public virtual bool Identify(string path)
public bool Identify(string path)
{
if(!File.Exists(path)) return false;
@@ -142,7 +142,7 @@ namespace DiscImageChef.Filters
return true;
}
public virtual void Open(byte[] buffer)
public void Open(byte[] buffer)
{
dataStream = new MemoryStream(buffer);
basePath = null;
@@ -153,7 +153,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(Stream stream)
public void Open(Stream stream)
{
dataStream = stream;
basePath = null;
@@ -164,7 +164,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(string path)
public void Open(string path)
{
dataStream = new FileStream(path, FileMode.Open, FileAccess.Read);
basePath = Path.GetFullPath(path);
@@ -180,32 +180,32 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual DateTime GetCreationTime()
public DateTime GetCreationTime()
{
return creationTime;
}
public virtual long GetDataForkLength()
public long GetDataForkLength()
{
return decompressedSize;
}
public virtual DateTime GetLastWriteTime()
public DateTime GetLastWriteTime()
{
return lastWriteTime;
}
public virtual long GetLength()
public long GetLength()
{
return decompressedSize;
}
public virtual long GetResourceForkLength()
public long GetResourceForkLength()
{
return 0;
}
public virtual string GetFilename()
public string GetFilename()
{
if(basePath?.EndsWith(".bz2", StringComparison.InvariantCultureIgnoreCase) == true)
return basePath.Substring(0, basePath.Length - 4);
@@ -215,12 +215,12 @@ namespace DiscImageChef.Filters
return basePath;
}
public virtual string GetParentFolder()
public string GetParentFolder()
{
return Path.GetDirectoryName(basePath);
}
public virtual bool IsOpened()
public bool IsOpened()
{
return opened;
}

View File

@@ -49,10 +49,10 @@ namespace DiscImageChef.Filters
bool opened;
Stream zStream;
public virtual string Name => "GZip";
public virtual Guid Id => new Guid("F4996661-4A29-42C9-A2C7-3904EF40F3B0");
public string Name => "GZip";
public Guid Id => new Guid("F4996661-4A29-42C9-A2C7-3904EF40F3B0");
public virtual void Close()
public void Close()
{
dataStream?.Close();
dataStream = null;
@@ -60,37 +60,37 @@ namespace DiscImageChef.Filters
opened = false;
}
public virtual string GetBasePath()
public string GetBasePath()
{
return basePath;
}
public virtual Stream GetDataForkStream()
public Stream GetDataForkStream()
{
return zStream;
}
public virtual string GetPath()
public string GetPath()
{
return basePath;
}
public virtual Stream GetResourceForkStream()
public Stream GetResourceForkStream()
{
return null;
}
public virtual bool HasResourceFork()
public bool HasResourceFork()
{
return false;
}
public virtual bool Identify(byte[] buffer)
public bool Identify(byte[] buffer)
{
return buffer[0] == 0x1F && buffer[1] == 0x8B && buffer[2] == 0x08;
}
public virtual bool Identify(Stream stream)
public bool Identify(Stream stream)
{
byte[] buffer = new byte[3];
@@ -101,7 +101,7 @@ namespace DiscImageChef.Filters
return buffer[0] == 0x1F && buffer[1] == 0x8B && buffer[2] == 0x08;
}
public virtual bool Identify(string path)
public bool Identify(string path)
{
if(!File.Exists(path)) return false;
@@ -115,7 +115,7 @@ namespace DiscImageChef.Filters
return buffer[0] == 0x1F && buffer[1] == 0x8B && buffer[2] == 0x08;
}
public virtual void Open(byte[] buffer)
public void Open(byte[] buffer)
{
byte[] mtime_b = new byte[4];
byte[] isize_b = new byte[4];
@@ -141,7 +141,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(Stream stream)
public void Open(Stream stream)
{
byte[] mtime_b = new byte[4];
byte[] isize_b = new byte[4];
@@ -167,7 +167,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(string path)
public void Open(string path)
{
byte[] mtime_b = new byte[4];
byte[] isize_b = new byte[4];
@@ -194,32 +194,32 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual DateTime GetCreationTime()
public DateTime GetCreationTime()
{
return creationTime;
}
public virtual long GetDataForkLength()
public long GetDataForkLength()
{
return decompressedSize;
}
public virtual DateTime GetLastWriteTime()
public DateTime GetLastWriteTime()
{
return lastWriteTime;
}
public virtual long GetLength()
public long GetLength()
{
return decompressedSize;
}
public virtual long GetResourceForkLength()
public long GetResourceForkLength()
{
return 0;
}
public virtual string GetFilename()
public string GetFilename()
{
if(basePath?.EndsWith(".gz", StringComparison.InvariantCultureIgnoreCase) == true)
return basePath.Substring(0, basePath.Length - 3);
@@ -229,12 +229,12 @@ namespace DiscImageChef.Filters
return basePath;
}
public virtual string GetParentFolder()
public string GetParentFolder()
{
return Path.GetDirectoryName(basePath);
}
public virtual bool IsOpened()
public bool IsOpened()
{
return opened;
}

View File

@@ -50,10 +50,10 @@ namespace DiscImageChef.Filters
DateTime lastWriteTime;
bool opened;
public virtual string Name => "LZip";
public virtual Guid Id => new Guid("09D715E9-20C0-48B1-A8D9-D8897CEC57C9");
public string Name => "LZip";
public Guid Id => new Guid("09D715E9-20C0-48B1-A8D9-D8897CEC57C9");
public virtual void Close()
public void Close()
{
dataStream?.Close();
dataStream = null;
@@ -61,38 +61,38 @@ namespace DiscImageChef.Filters
opened = false;
}
public virtual string GetBasePath()
public string GetBasePath()
{
return basePath;
}
public virtual Stream GetDataForkStream()
public Stream GetDataForkStream()
{
return innerStream;
}
public virtual string GetPath()
public string GetPath()
{
return basePath;
}
public virtual Stream GetResourceForkStream()
public Stream GetResourceForkStream()
{
return null;
}
public virtual bool HasResourceFork()
public bool HasResourceFork()
{
return false;
}
public virtual bool Identify(byte[] buffer)
public bool Identify(byte[] buffer)
{
return buffer[0] == 0x4C && buffer[1] == 0x5A && buffer[2] == 0x49 && buffer[3] == 0x50 &&
buffer[4] == 0x01;
}
public virtual bool Identify(Stream stream)
public bool Identify(Stream stream)
{
byte[] buffer = new byte[5];
@@ -104,7 +104,7 @@ namespace DiscImageChef.Filters
buffer[4] == 0x01;
}
public virtual bool Identify(string path)
public bool Identify(string path)
{
if(!File.Exists(path)) return false;
@@ -119,7 +119,7 @@ namespace DiscImageChef.Filters
buffer[4] == 0x01;
}
public virtual void Open(byte[] buffer)
public void Open(byte[] buffer)
{
dataStream = new MemoryStream(buffer);
basePath = null;
@@ -131,7 +131,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(Stream stream)
public void Open(Stream stream)
{
dataStream = stream;
basePath = null;
@@ -147,7 +147,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(string path)
public void Open(string path)
{
dataStream = new FileStream(path, FileMode.Open, FileAccess.Read);
basePath = Path.GetFullPath(path);
@@ -168,32 +168,32 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual DateTime GetCreationTime()
public DateTime GetCreationTime()
{
return creationTime;
}
public virtual long GetDataForkLength()
public long GetDataForkLength()
{
return decompressedSize;
}
public virtual DateTime GetLastWriteTime()
public DateTime GetLastWriteTime()
{
return lastWriteTime;
}
public virtual long GetLength()
public long GetLength()
{
return decompressedSize;
}
public virtual long GetResourceForkLength()
public long GetResourceForkLength()
{
return 0;
}
public virtual string GetFilename()
public string GetFilename()
{
if(basePath?.EndsWith(".lz", StringComparison.InvariantCultureIgnoreCase) == true)
return basePath.Substring(0, basePath.Length - 3);
@@ -203,12 +203,12 @@ namespace DiscImageChef.Filters
return basePath;
}
public virtual string GetParentFolder()
public string GetParentFolder()
{
return Path.GetDirectoryName(basePath);
}
public virtual bool IsOpened()
public bool IsOpened()
{
return opened;
}

View File

@@ -56,10 +56,10 @@ namespace DiscImageChef.Filters
long rsrcForkOff;
Stream stream;
public virtual string Name => "MacBinary";
public virtual Guid Id => new Guid("D7C321D3-E51F-45DF-A150-F6BFDF0D7704");
public string Name => "MacBinary";
public Guid Id => new Guid("D7C321D3-E51F-45DF-A150-F6BFDF0D7704");
public virtual void Close()
public void Close()
{
bytes = null;
stream?.Close();
@@ -69,22 +69,22 @@ namespace DiscImageChef.Filters
opened = false;
}
public virtual string GetBasePath()
public string GetBasePath()
{
return basePath;
}
public virtual DateTime GetCreationTime()
public DateTime GetCreationTime()
{
return creationTime;
}
public virtual long GetDataForkLength()
public long GetDataForkLength()
{
return header.dataLength;
}
public virtual Stream GetDataForkStream()
public Stream GetDataForkStream()
{
if(header.dataLength == 0) return null;
@@ -97,37 +97,37 @@ namespace DiscImageChef.Filters
return null;
}
public virtual string GetFilename()
public string GetFilename()
{
return filename;
}
public virtual DateTime GetLastWriteTime()
public DateTime GetLastWriteTime()
{
return lastWriteTime;
}
public virtual long GetLength()
public long GetLength()
{
return header.dataLength + header.resourceLength;
}
public virtual string GetParentFolder()
public string GetParentFolder()
{
return Path.GetDirectoryName(basePath);
}
public virtual string GetPath()
public string GetPath()
{
return basePath;
}
public virtual long GetResourceForkLength()
public long GetResourceForkLength()
{
return header.resourceLength;
}
public virtual Stream GetResourceForkStream()
public Stream GetResourceForkStream()
{
if(header.resourceLength == 0) return null;
@@ -140,12 +140,12 @@ namespace DiscImageChef.Filters
return null;
}
public virtual bool HasResourceFork()
public bool HasResourceFork()
{
return header.resourceLength > 0;
}
public virtual bool Identify(byte[] buffer)
public bool Identify(byte[] buffer)
{
if(buffer == null || buffer.Length < 128) return false;
@@ -158,7 +158,7 @@ namespace DiscImageChef.Filters
(header.dataLength > 0 || header.resourceLength > 0);
}
public virtual bool Identify(Stream stream)
public bool Identify(Stream stream)
{
if(stream == null || stream.Length < 128) return false;
@@ -172,7 +172,7 @@ namespace DiscImageChef.Filters
(header.dataLength > 0 || header.resourceLength > 0);
}
public virtual bool Identify(string path)
public bool Identify(string path)
{
FileStream fstream = new FileStream(path, FileMode.Open, FileAccess.Read);
if(fstream.Length < 128) return false;
@@ -187,12 +187,12 @@ namespace DiscImageChef.Filters
(header.dataLength > 0 || header.resourceLength > 0);
}
public virtual bool IsOpened()
public bool IsOpened()
{
return opened;
}
public virtual void Open(byte[] buffer)
public void Open(byte[] buffer)
{
MemoryStream ms = new MemoryStream(buffer);
ms.Seek(0, SeekOrigin.Begin);
@@ -219,7 +219,7 @@ namespace DiscImageChef.Filters
bytes = buffer;
}
public virtual void Open(Stream stream)
public void Open(Stream stream)
{
stream.Seek(0, SeekOrigin.Begin);
@@ -245,7 +245,7 @@ namespace DiscImageChef.Filters
this.stream = stream;
}
public virtual void Open(string path)
public void Open(string path)
{
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
fs.Seek(0, SeekOrigin.Begin);

View File

@@ -57,86 +57,86 @@ namespace DiscImageChef.Filters
long rsrcLen;
string rsrcPath;
public virtual string Name => "PCExchange";
public virtual Guid Id => new Guid("9264EB9F-D634-4F9B-BE12-C24CD44988C6");
public string Name => "PCExchange";
public Guid Id => new Guid("9264EB9F-D634-4F9B-BE12-C24CD44988C6");
public virtual void Close()
public void Close()
{
opened = false;
}
public virtual string GetBasePath()
public string GetBasePath()
{
return basePath;
}
public virtual DateTime GetCreationTime()
public DateTime GetCreationTime()
{
return creationTime;
}
public virtual long GetDataForkLength()
public long GetDataForkLength()
{
return dataLen;
}
public virtual Stream GetDataForkStream()
public Stream GetDataForkStream()
{
return new FileStream(dataPath, FileMode.Open, FileAccess.Read);
}
public virtual string GetFilename()
public string GetFilename()
{
return Path.GetFileName(basePath);
}
public virtual DateTime GetLastWriteTime()
public DateTime GetLastWriteTime()
{
return lastWriteTime;
}
public virtual long GetLength()
public long GetLength()
{
return dataLen + rsrcLen;
}
public virtual string GetParentFolder()
public string GetParentFolder()
{
return Path.GetDirectoryName(basePath);
}
public virtual string GetPath()
public string GetPath()
{
return basePath;
}
public virtual long GetResourceForkLength()
public long GetResourceForkLength()
{
return rsrcLen;
}
public virtual Stream GetResourceForkStream()
public Stream GetResourceForkStream()
{
return new FileStream(rsrcPath, FileMode.Open, FileAccess.Read);
}
public virtual bool HasResourceFork()
public bool HasResourceFork()
{
return rsrcPath != null;
}
public virtual bool Identify(byte[] buffer)
public bool Identify(byte[] buffer)
{
return false;
}
public virtual bool Identify(Stream stream)
public bool Identify(Stream stream)
{
System.Console.WriteLine("parentFolder");
return false;
}
public virtual bool Identify(string path)
public bool Identify(string path)
{
string parentFolder = Path.GetDirectoryName(path);
@@ -187,22 +187,22 @@ namespace DiscImageChef.Filters
return dataFound && rsrcFound;
}
public virtual bool IsOpened()
public bool IsOpened()
{
return opened;
}
public virtual void Open(byte[] buffer)
public void Open(byte[] buffer)
{
throw new NotSupportedException();
}
public virtual void Open(Stream stream)
public void Open(Stream stream)
{
throw new NotSupportedException();
}
public virtual void Open(string path)
public void Open(string path)
{
string parentFolder = Path.GetDirectoryName(path);
string baseFilename = Path.GetFileName(path);

View File

@@ -49,10 +49,10 @@ namespace DiscImageChef.Filters
DateTime lastWriteTime;
bool opened;
public virtual string Name => "XZ";
public virtual Guid Id => new Guid("666A8617-0444-4C05-9F4F-DF0FD758D0D2");
public string Name => "XZ";
public Guid Id => new Guid("666A8617-0444-4C05-9F4F-DF0FD758D0D2");
public virtual void Close()
public void Close()
{
dataStream?.Close();
dataStream = null;
@@ -60,39 +60,39 @@ namespace DiscImageChef.Filters
opened = false;
}
public virtual string GetBasePath()
public string GetBasePath()
{
return basePath;
}
public virtual Stream GetDataForkStream()
public Stream GetDataForkStream()
{
return innerStream;
}
public virtual string GetPath()
public string GetPath()
{
return basePath;
}
public virtual Stream GetResourceForkStream()
public Stream GetResourceForkStream()
{
return null;
}
public virtual bool HasResourceFork()
public bool HasResourceFork()
{
return false;
}
public virtual bool Identify(byte[] buffer)
public bool Identify(byte[] buffer)
{
return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 &&
buffer[4] == 0x5A && buffer[5] == 0x00 && buffer[buffer.Length - 2] == 0x59 &&
buffer[buffer.Length - 1] == 0x5A;
}
public virtual bool Identify(Stream stream)
public bool Identify(Stream stream)
{
byte[] buffer = new byte[6];
byte[] footer = new byte[2];
@@ -107,7 +107,7 @@ namespace DiscImageChef.Filters
buffer[4] == 0x5A && buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A;
}
public virtual bool Identify(string path)
public bool Identify(string path)
{
if(!File.Exists(path)) return false;
@@ -172,7 +172,7 @@ namespace DiscImageChef.Filters
return i;
}
public virtual void Open(byte[] buffer)
public void Open(byte[] buffer)
{
dataStream = new MemoryStream(buffer);
basePath = null;
@@ -183,7 +183,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(Stream stream)
public void Open(Stream stream)
{
dataStream = stream;
basePath = null;
@@ -194,7 +194,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(string path)
public void Open(string path)
{
dataStream = new FileStream(path, FileMode.Open, FileAccess.Read);
basePath = Path.GetFullPath(path);
@@ -210,32 +210,32 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual DateTime GetCreationTime()
public DateTime GetCreationTime()
{
return creationTime;
}
public virtual long GetDataForkLength()
public long GetDataForkLength()
{
return decompressedSize;
}
public virtual DateTime GetLastWriteTime()
public DateTime GetLastWriteTime()
{
return lastWriteTime;
}
public virtual long GetLength()
public long GetLength()
{
return decompressedSize;
}
public virtual long GetResourceForkLength()
public long GetResourceForkLength()
{
return 0;
}
public virtual string GetFilename()
public string GetFilename()
{
if(basePath?.EndsWith(".xz", StringComparison.InvariantCultureIgnoreCase) == true)
return basePath.Substring(0, basePath.Length - 3);
@@ -245,12 +245,12 @@ namespace DiscImageChef.Filters
: basePath;
}
public virtual string GetParentFolder()
public string GetParentFolder()
{
return Path.GetDirectoryName(basePath);
}
public virtual bool IsOpened()
public bool IsOpened()
{
return opened;
}

View File

@@ -46,10 +46,10 @@ namespace DiscImageChef.Filters
DateTime lastWriteTime;
bool opened;
public virtual string Name => "No filter";
public virtual Guid Id => new Guid("12345678-AAAA-BBBB-CCCC-123456789000");
public string Name => "No filter";
public Guid Id => new Guid("12345678-AAAA-BBBB-CCCC-123456789000");
public virtual void Close()
public void Close()
{
dataStream?.Close();
dataStream = null;
@@ -57,48 +57,48 @@ namespace DiscImageChef.Filters
opened = false;
}
public virtual string GetBasePath()
public string GetBasePath()
{
return basePath;
}
public virtual Stream GetDataForkStream()
public Stream GetDataForkStream()
{
return dataStream;
}
public virtual string GetPath()
public string GetPath()
{
return basePath;
}
public virtual Stream GetResourceForkStream()
public Stream GetResourceForkStream()
{
return null;
}
public virtual bool HasResourceFork()
public bool HasResourceFork()
{
// TODO: Implement support for xattrs/ADS
return false;
}
public virtual bool Identify(byte[] buffer)
public bool Identify(byte[] buffer)
{
return buffer != null && buffer.Length > 0;
}
public virtual bool Identify(Stream stream)
public bool Identify(Stream stream)
{
return stream != null && stream.Length > 0;
}
public virtual bool Identify(string path)
public bool Identify(string path)
{
return File.Exists(path);
}
public virtual void Open(byte[] buffer)
public void Open(byte[] buffer)
{
dataStream = new MemoryStream(buffer);
basePath = null;
@@ -107,7 +107,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(Stream stream)
public void Open(Stream stream)
{
dataStream = stream;
basePath = null;
@@ -116,7 +116,7 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual void Open(string path)
public void Open(string path)
{
dataStream = new FileStream(path, FileMode.Open, FileAccess.Read);
basePath = Path.GetFullPath(path);
@@ -126,42 +126,42 @@ namespace DiscImageChef.Filters
opened = true;
}
public virtual DateTime GetCreationTime()
public DateTime GetCreationTime()
{
return creationTime;
}
public virtual long GetDataForkLength()
public long GetDataForkLength()
{
return dataStream.Length;
}
public virtual DateTime GetLastWriteTime()
public DateTime GetLastWriteTime()
{
return lastWriteTime;
}
public virtual long GetLength()
public long GetLength()
{
return dataStream.Length;
}
public virtual long GetResourceForkLength()
public long GetResourceForkLength()
{
return 0;
}
public virtual string GetFilename()
public string GetFilename()
{
return Path.GetFileName(basePath);
}
public virtual string GetParentFolder()
public string GetParentFolder()
{
return Path.GetDirectoryName(basePath);
}
public virtual bool IsOpened()
public bool IsOpened()
{
return opened;
}