-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
164 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/Altinn.App.Core/Features/FileAnalysis/FileAnalysisResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace Altinn.App.Core.Features.FileAnalysis; | ||
|
||
/// <summary> | ||
/// Results from a file analysis done based the content of the file, ie. the binary data. | ||
/// </summary> | ||
public class FileAnalysisResult | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="FileAnalysisService"/> class. | ||
/// </summary> | ||
public FileAnalysisResult(string analyserId) | ||
{ | ||
AnalyserId = analyserId; | ||
} | ||
|
||
/// <summary> | ||
/// The id of the analyser generating the result. | ||
/// </summary> | ||
public string AnalyserId { get; internal set; } | ||
|
||
/// <summary> | ||
/// The name of the analysed file. | ||
/// </summary> | ||
public string? Filename { get; set; } | ||
|
||
/// <summary> | ||
/// The file extension(s) without the . i.e. pdf | png | docx | ||
/// Some mime types might have multiple extensions registered for ecample image/jpeg has both jpg and jpeg. | ||
/// </summary> | ||
public List<string> Extensions { get; set; } = new List<string>(); | ||
|
||
/// <summary> | ||
/// The mime type | ||
/// </summary> | ||
public string? MimeType { get; set; } | ||
|
||
/// <summary> | ||
/// Key/Value pairs containing findings from the analysis. | ||
/// </summary> | ||
public IDictionary<string, string> Metadata { get; private set; } = new Dictionary<string, string>(); | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Altinn.App.Core/Features/FileAnalysis/IFileAnalyser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Altinn.App.Core.Features.FileAnalysis; | ||
|
||
/// <summary> | ||
/// Interface for doing extended binary file analysing. | ||
/// </summary> | ||
public interface IFileAnalyser | ||
{ | ||
/// <summary> | ||
/// The id of the analyser to be used when enabling it from config. | ||
/// </summary> | ||
public string Id { get; } | ||
|
||
/// <summary> | ||
/// Analyses a stream with the intent to extract metadata. | ||
/// </summary> | ||
/// <param name="stream">The stream to analyse. One stream = one file.</param> | ||
/// <param name="filename">Filename. Optional parameter if the implementation needs the name of the file, relative or absolute path.</param> | ||
public Task<FileAnalysisResult> Analyse(Stream stream, string? filename = null); | ||
} |
29 changes: 0 additions & 29 deletions
29
src/Altinn.App.Core/Features/FileAnalyzis/FileAnalyserFactory.cs
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
src/Altinn.App.Core/Features/FileAnalyzis/FileAnalysisResult.cs
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
src/Altinn.App.Core/Features/FileAnalyzis/FileAnalysisService.cs
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/Altinn.App.Core/Features/FileAnalyzis/IFileAnalyser.cs
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
src/Altinn.App.Core/Features/FileAnalyzis/IFileAnalyserFactory.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.