mirror of
https://github.com/volodymyrsmirnov/MalwareMultiScan.git
synced 2025-10-11 04:26:16 +00:00
refactoring, documentation pending
This commit is contained in:
@@ -18,15 +18,12 @@ namespace MalwareMultiScan.Backends.Backends.Abstracts
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
protected virtual Regex MatchRegex { get; }
|
||||
protected virtual string BackendPath { get; }
|
||||
protected abstract Regex MatchRegex { get; }
|
||||
protected abstract string BackendPath { get; }
|
||||
protected virtual bool ParseStdErr { get; }
|
||||
protected virtual bool ThrowOnNonZeroExitCode { get; } = true;
|
||||
|
||||
protected virtual string GetBackendArguments(string path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
protected abstract string GetBackendArguments(string path);
|
||||
|
||||
public override async Task<string[]> ScanAsync(string path, CancellationToken cancellationToken)
|
||||
{
|
||||
|
@@ -3,23 +3,21 @@ using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MalwareMultiScan.Shared.Interfaces;
|
||||
using MalwareMultiScan.Backends.Interfaces;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace MalwareMultiScan.Backends.Backends.Abstracts
|
||||
{
|
||||
public abstract class AbstractScanBackend : IScanBackend
|
||||
{
|
||||
public virtual string Id => throw new NotImplementedException();
|
||||
public abstract string Id { get; }
|
||||
|
||||
public virtual Task<string[]> ScanAsync(string path, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public abstract Task<string[]> ScanAsync(string path, CancellationToken cancellationToken);
|
||||
|
||||
public async Task<string[]> ScanAsync(Uri uri, CancellationToken cancellationToken)
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
|
||||
await using var uriStream = await httpClient.GetStreamAsync(uri);
|
||||
|
||||
return await ScanAsync(uriStream, cancellationToken);
|
||||
|
Reference in New Issue
Block a user