mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Define new ArtifactKey field
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
- Replace GetLogFilePaths with common code
|
||||
- Move GetLogFilePaths to better location
|
||||
- Replace GenerateArtifacts with common code
|
||||
- Define new ArtifactKey field
|
||||
|
||||
### 3.2.1 (2024-08-05)
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace MPF.Processors
|
||||
foreach (var outputFile in outputFiles)
|
||||
{
|
||||
// Skip non-artifact files
|
||||
if (!outputFile.IsArtifact)
|
||||
if (!outputFile.IsArtifact || outputFile.ArtifactKey == null)
|
||||
continue;
|
||||
|
||||
// Skip non-existent files
|
||||
@@ -91,13 +91,13 @@ namespace MPF.Processors
|
||||
{
|
||||
byte[] data = File.ReadAllBytes(filename);
|
||||
string str = Convert.ToBase64String(data);
|
||||
info.Artifacts!.Add(filename, str);
|
||||
info.Artifacts!.Add(outputFile.ArtifactKey, str);
|
||||
}
|
||||
else
|
||||
{
|
||||
string? data = ProcessingTool.GetFullFile(filename);
|
||||
string str = ProcessingTool.GetBase64(data) ?? string.Empty;
|
||||
info.Artifacts!.Add(filename, str);
|
||||
info.Artifacts!.Add(outputFile.ArtifactKey, str);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -50,6 +50,11 @@ namespace MPF.Processors
|
||||
/// </summary>
|
||||
public string[] Filenames { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Key used when creating an artifact
|
||||
/// </summary>
|
||||
public string? ArtifactKey { get; private set;}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the file is required
|
||||
/// </summary>
|
||||
@@ -132,12 +137,25 @@ namespace MPF.Processors
|
||||
/// </summary>
|
||||
private readonly OutputFileFlags _flags;
|
||||
|
||||
// TODO: Add validation that a key exists if the artifact flag is present
|
||||
|
||||
/// <summary>
|
||||
/// Create an OutputFile with a single filename
|
||||
/// </summary>
|
||||
public OutputFile(string filename, OutputFileFlags flags)
|
||||
{
|
||||
Filenames = [filename];
|
||||
ArtifactKey = null;
|
||||
_flags = flags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an OutputFile with a single filename
|
||||
/// </summary>
|
||||
public OutputFile(string filename, OutputFileFlags flags, string artifactKey)
|
||||
{
|
||||
Filenames = [filename];
|
||||
ArtifactKey = artifactKey;
|
||||
_flags = flags;
|
||||
}
|
||||
|
||||
@@ -147,6 +165,17 @@ namespace MPF.Processors
|
||||
public OutputFile(string[] filenames, OutputFileFlags flags)
|
||||
{
|
||||
Filenames = filenames;
|
||||
ArtifactKey = null;
|
||||
_flags = flags;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an OutputFile with set of filenames
|
||||
/// </summary>
|
||||
public OutputFile(string[] filenames, OutputFileFlags flags, string artifactKey)
|
||||
{
|
||||
Filenames = filenames;
|
||||
ArtifactKey = artifactKey;
|
||||
_flags = flags;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user