Use the Volume Label special site code (fixes #337)

This commit is contained in:
Matt Nadareski
2021-12-24 15:13:06 -08:00
parent 31dd32f19b
commit fab54ca0ae
4 changed files with 17 additions and 7 deletions

View File

@@ -39,6 +39,7 @@
- Fix saving path settings if set from dialog
- Allow default system if skipping system detection enabled
- Add internal support for all Redump site codes
- Use the Volume Label special site code
### 2.1 (2021-07-22)
- Enum, no more

View File

@@ -48,7 +48,12 @@ namespace MPF.Core.Data
/// <summary>
/// Media label as read by Windows
/// </summary>
public string VolumeLabel
public string VolumeLabel => driveInfo?.VolumeLabel;
/// <summary>
/// Media label as read by Windows, formatted to avoid odd outputs
/// </summary>
public string FormattedVolumeLabel
{
get
{
@@ -250,7 +255,7 @@ namespace MPF.Core.Data
return RedumpSystem.IBMPCcompatible;
// Audio CD
if (this.VolumeLabel.Equals("Audio CD", StringComparison.OrdinalIgnoreCase))
if (this.FormattedVolumeLabel.Equals("Audio CD", StringComparison.OrdinalIgnoreCase))
{
return RedumpSystem.AudioCD;
}
@@ -280,7 +285,7 @@ namespace MPF.Core.Data
&& Directory.EnumerateFiles(Path.Combine(drivePath, "VIDEO_TS")).Any())
{
// TODO: Maybe add video track hashes to compare for Xbox and X360?
if (this.VolumeLabel.StartsWith("SEP13011042", StringComparison.OrdinalIgnoreCase))
if (this.FormattedVolumeLabel.StartsWith("SEP13011042", StringComparison.OrdinalIgnoreCase))
return RedumpSystem.MicrosoftXbox;
return RedumpSystem.DVDVideo;
@@ -346,19 +351,19 @@ namespace MPF.Core.Data
}
// Sony PlayStation 3
if (this.VolumeLabel.Equals("PS3VOLUME", StringComparison.OrdinalIgnoreCase))
if (this.FormattedVolumeLabel.Equals("PS3VOLUME", StringComparison.OrdinalIgnoreCase))
{
return RedumpSystem.SonyPlayStation3;
}
// Sony PlayStation 4
if (this.VolumeLabel.Equals("PS4VOLUME", StringComparison.OrdinalIgnoreCase))
if (this.FormattedVolumeLabel.Equals("PS4VOLUME", StringComparison.OrdinalIgnoreCase))
{
return RedumpSystem.SonyPlayStation4;
}
// Sony PlayStation 5
if (this.VolumeLabel.Equals("PS5VOLUME", StringComparison.OrdinalIgnoreCase))
if (this.FormattedVolumeLabel.Equals("PS5VOLUME", StringComparison.OrdinalIgnoreCase))
{
return RedumpSystem.SonyPlayStation5;
}

View File

@@ -158,6 +158,10 @@ namespace MPF.Library
if (!string.IsNullOrWhiteSpace(info.SizeAndChecksums.CRC32))
info.TracksAndWriteOffsets.ClrMameProData = null;
// Add the volume label to comments, if possible
if (!string.IsNullOrWhiteSpace(drive?.VolumeLabel) && !info.CommonDiscInfo.Comments.Contains(Template.VolumeLabelCommentField))
info.CommonDiscInfo.Comments += $"{Template.VolumeLabelCommentField} {drive.VolumeLabel}\n";
// Extract info based generically on MediaType
switch (mediaType)
{

View File

@@ -827,7 +827,7 @@ namespace MPF.GUI.ViewModels
// Set the output filename, if we changed drives or it's not already
if (driveChanged || string.IsNullOrEmpty(App.Instance.OutputFilenameTextBox.Text))
App.Instance.OutputFilenameTextBox.Text = (drive?.VolumeLabel ?? systemType.LongName()) + (extension ?? ".bin");
App.Instance.OutputFilenameTextBox.Text = (drive?.FormattedVolumeLabel ?? systemType.LongName()) + (extension ?? ".bin");
// If the extension for the file changed, update that automatically
else if (Path.GetExtension(App.Instance.OutputFilenameTextBox.Text) != extension)