mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Move to file scoped namespaces.
This commit is contained in:
@@ -35,106 +35,105 @@ using System.IO;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filters
|
||||
namespace Aaru.Filters;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>No filter for reading files not recognized by any filter</summary>
|
||||
public sealed class ZZZNoFilter : IFilter
|
||||
{
|
||||
Stream _dataStream;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>No filter for reading files not recognized by any filter</summary>
|
||||
public sealed class ZZZNoFilter : IFilter
|
||||
public string Name => "No filter";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("12345678-AAAA-BBBB-CCCC-123456789000");
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Close()
|
||||
{
|
||||
Stream _dataStream;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "No filter";
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("12345678-AAAA-BBBB-CCCC-123456789000");
|
||||
/// <inheritdoc />
|
||||
public string Author => "Natalia Portillo";
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Close()
|
||||
{
|
||||
_dataStream?.Close();
|
||||
_dataStream = null;
|
||||
BasePath = null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string BasePath { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Stream GetDataForkStream() => _dataStream;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Path => BasePath;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Stream GetResourceForkStream() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasResourceFork => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(byte[] buffer) => buffer != null && buffer.Length > 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(Stream stream) => stream != null && stream.Length > 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(string path) => File.Exists(path);
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(byte[] buffer)
|
||||
{
|
||||
_dataStream = new MemoryStream(buffer);
|
||||
BasePath = null;
|
||||
CreationTime = DateTime.UtcNow;
|
||||
LastWriteTime = CreationTime;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(Stream stream)
|
||||
{
|
||||
_dataStream = stream;
|
||||
BasePath = null;
|
||||
CreationTime = DateTime.UtcNow;
|
||||
LastWriteTime = CreationTime;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(string path)
|
||||
{
|
||||
_dataStream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BasePath = System.IO.Path.GetFullPath(path);
|
||||
var fi = new FileInfo(path);
|
||||
CreationTime = fi.CreationTimeUtc;
|
||||
LastWriteTime = fi.LastWriteTimeUtc;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTime CreationTime { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public long DataForkLength => _dataStream.Length;
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTime LastWriteTime { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public long Length => _dataStream.Length;
|
||||
|
||||
/// <inheritdoc />
|
||||
public long ResourceForkLength => 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Filename => System.IO.Path.GetFileName(BasePath);
|
||||
|
||||
/// <inheritdoc />
|
||||
public string ParentFolder => System.IO.Path.GetDirectoryName(BasePath);
|
||||
_dataStream?.Close();
|
||||
_dataStream = null;
|
||||
BasePath = null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string BasePath { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Stream GetDataForkStream() => _dataStream;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Path => BasePath;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Stream GetResourceForkStream() => null;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool HasResourceFork => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(byte[] buffer) => buffer != null && buffer.Length > 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(Stream stream) => stream != null && stream.Length > 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(string path) => File.Exists(path);
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(byte[] buffer)
|
||||
{
|
||||
_dataStream = new MemoryStream(buffer);
|
||||
BasePath = null;
|
||||
CreationTime = DateTime.UtcNow;
|
||||
LastWriteTime = CreationTime;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(Stream stream)
|
||||
{
|
||||
_dataStream = stream;
|
||||
BasePath = null;
|
||||
CreationTime = DateTime.UtcNow;
|
||||
LastWriteTime = CreationTime;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(string path)
|
||||
{
|
||||
_dataStream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BasePath = System.IO.Path.GetFullPath(path);
|
||||
var fi = new FileInfo(path);
|
||||
CreationTime = fi.CreationTimeUtc;
|
||||
LastWriteTime = fi.LastWriteTimeUtc;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTime CreationTime { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public long DataForkLength => _dataStream.Length;
|
||||
|
||||
/// <inheritdoc />
|
||||
public DateTime LastWriteTime { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public long Length => _dataStream.Length;
|
||||
|
||||
/// <inheritdoc />
|
||||
public long ResourceForkLength => 0;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Filename => System.IO.Path.GetFileName(BasePath);
|
||||
|
||||
/// <inheritdoc />
|
||||
public string ParentFolder => System.IO.Path.GetDirectoryName(BasePath);
|
||||
}
|
||||
Reference in New Issue
Block a user