🎨Converted all plugin types to interfaces.

This commit is contained in:
2017-12-26 06:05:12 +00:00
parent a002253fa4
commit f66a0bdd42
295 changed files with 9499 additions and 10414 deletions

View File

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