mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Add dumping date to log (fixes #533)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
- Add known .NET 6 limitations to README
|
||||
- Remove `_drive.txt` from required UIC outputs
|
||||
- Make `use` flag required for MPF.Check
|
||||
- Add dumping date to log
|
||||
|
||||
### 2.6.2 (2023-07-25)
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace MPF.Core.Data
|
||||
// Automatic Information
|
||||
|
||||
public const string DumpingProgramField = "Dumping Program";
|
||||
public const string DumpingDateField = "Date";
|
||||
public const string DumpingDriveManufacturer = "Manufacturer";
|
||||
public const string DumpingDriveModel = "Model";
|
||||
public const string DumpingDriveFirmware = "Firmware";
|
||||
|
||||
@@ -857,6 +857,7 @@ namespace MPF.Library
|
||||
// Dumping Info section
|
||||
output.Add(""); output.Add("Dumping Info:");
|
||||
AddIfExists(output, Template.DumpingProgramField, info.DumpingInfo.DumpingProgram, 1);
|
||||
AddIfExists(output, Template.DumpingDateField, info.DumpingInfo.DumpingDate, 1);
|
||||
AddIfExists(output, Template.DumpingDriveManufacturer, info.DumpingInfo.Manufacturer, 1);
|
||||
AddIfExists(output, Template.DumpingDriveModel, info.DumpingInfo.Model, 1);
|
||||
AddIfExists(output, Template.DumpingDriveFirmware, info.DumpingInfo.Firmware, 1);
|
||||
|
||||
@@ -199,6 +199,7 @@ namespace MPF.Modules.Aaru
|
||||
|
||||
// TODO: Determine if there's an Aaru version anywhere
|
||||
info.DumpingInfo.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
info.DumpingInfo.DumpingDate = GetFileModifiedDate(basePath + ".cicm.xml")?.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
// Deserialize the sidecar, if possible
|
||||
var sidecar = GenerateSidecar(basePath + ".cicm.xml");
|
||||
|
||||
@@ -1339,6 +1339,22 @@ namespace MPF.Modules
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the last modified date from a file path, if possible
|
||||
/// </summary>
|
||||
/// <param name="filename">Path to the input file</param>
|
||||
/// <returns>Filled DateTime on success, null on failure</returns>
|
||||
protected static DateTime? GetFileModifiedDate(string filename, bool fallback = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filename))
|
||||
return fallback ? (DateTime?)DateTime.UtcNow : null;
|
||||
else if (!File.Exists(filename))
|
||||
return fallback ? (DateTime?)DateTime.UtcNow : null;
|
||||
|
||||
var fi = new FileInfo(filename);
|
||||
return fi.LastWriteTimeUtc;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the split values for ISO-based media
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -63,6 +64,8 @@ namespace MPF.Modules.CleanRip
|
||||
{
|
||||
// TODO: Determine if there's a CleanRip version anywhere
|
||||
info.DumpingInfo.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
info.DumpingInfo.DumpingDate = GetFileModifiedDate(basePath + "-dumpinfo.txt")?.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
Datafile datafile = GenerateCleanripDatafile(basePath + ".iso", basePath + "-dumpinfo.txt");
|
||||
|
||||
// Get the individual hash data, as per internal
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -83,6 +84,7 @@ namespace MPF.Modules.DD
|
||||
|
||||
// TODO: Determine if there's a DD version anywhere
|
||||
info.DumpingInfo.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
info.DumpingInfo.DumpingDate = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
switch (this.Type)
|
||||
{
|
||||
|
||||
@@ -389,8 +389,9 @@ namespace MPF.Modules.DiscImageCreator
|
||||
string outputDirectory = Path.GetDirectoryName(basePath);
|
||||
|
||||
// Get the dumping program and version
|
||||
(_, string dicVersion) = GetCommandFilePathAndVersion(basePath);
|
||||
(string dicCmd, string dicVersion) = GetCommandFilePathAndVersion(basePath);
|
||||
info.DumpingInfo.DumpingProgram = $"{EnumConverter.LongName(this.InternalProgram)} {dicVersion ?? "Unknown Version"}";
|
||||
info.DumpingInfo.DumpingDate = GetFileModifiedDate(dicCmd)?.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
// Fill in the hardware data
|
||||
if (GetHardwareInfo($"{basePath}_drive.txt", out string manufacturer, out string model, out string firmware))
|
||||
|
||||
@@ -247,6 +247,7 @@ namespace MPF.Modules.Redumper
|
||||
{
|
||||
// Get the dumping program and version
|
||||
info.DumpingInfo.DumpingProgram = $"{EnumConverter.LongName(this.InternalProgram)} {GetVersion($"{basePath}.log") ?? "Unknown Version"}";
|
||||
info.DumpingInfo.DumpingDate = GetFileModifiedDate($"{basePath}.log")?.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
// Fill in the hardware data
|
||||
if (GetHardwareInfo($"{basePath}.log", out string manufacturer, out string model, out string firmware))
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace MPF.Modules.UmdImageCreator
|
||||
{
|
||||
// TODO: Determine if there's a UMDImageCreator version anywhere
|
||||
info.DumpingInfo.DumpingProgram = EnumConverter.LongName(this.InternalProgram);
|
||||
info.DumpingInfo.DumpingDate = GetFileModifiedDate(basePath + "_disc.txt")?.ToString("yyyy-MM-dd hh:mm:ss");
|
||||
|
||||
// Extract info based generically on MediaType
|
||||
switch (this.Type)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using psxt001z;
|
||||
using RedumpLib.Data;
|
||||
using Xunit;
|
||||
|
||||
@@ -160,6 +161,7 @@ namespace MPF.Test.RedumpLib
|
||||
DumpingInfo = new DumpingInfoSection()
|
||||
{
|
||||
DumpingProgram = "DiscImageCreator 20500101",
|
||||
DumpingDate = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss"),
|
||||
Manufacturer = "ATAPI",
|
||||
Model = "Optical Drive",
|
||||
Firmware = "1.23",
|
||||
|
||||
@@ -424,6 +424,7 @@ namespace MPF.UI.ViewModels
|
||||
DumpingInfo = new DumpingInfoSection()
|
||||
{
|
||||
DumpingProgram = "DiscImageCreator 20500101",
|
||||
DumpingDate = DateTime.UtcNow.ToString("yyyy-MM-dd hh:mm:ss"),
|
||||
Manufacturer = "ATAPI",
|
||||
Model = "Optical Drive",
|
||||
Firmware = "1.23",
|
||||
|
||||
@@ -534,6 +534,10 @@ namespace RedumpLib.Data
|
||||
[JsonProperty(PropertyName = "d_dumping_program", Required = Required.AllowNull)]
|
||||
public string DumpingProgram { get; set; }
|
||||
|
||||
// Name not defined by Redump
|
||||
[JsonProperty(PropertyName = "d_dumping_date", Required = Required.AllowNull)]
|
||||
public string DumpingDate { get; set; }
|
||||
|
||||
// Name not defined by Redump
|
||||
[JsonProperty(PropertyName = "d_drive_manufacturer", Required = Required.AllowNull)]
|
||||
public string Manufacturer { get; set; }
|
||||
@@ -555,6 +559,7 @@ namespace RedumpLib.Data
|
||||
return new DumpingInfoSection
|
||||
{
|
||||
DumpingProgram = this.DumpingProgram,
|
||||
DumpingDate = this.DumpingDate,
|
||||
Manufacturer = this.Manufacturer,
|
||||
Model = this.Model,
|
||||
Firmware = this.Firmware,
|
||||
|
||||
Reference in New Issue
Block a user