Fix PS4 autodetect (Fixes #164)

This commit is contained in:
Matt Nadareski
2019-09-29 21:14:25 -07:00
parent 04348d2d58
commit d431a4c87f
2 changed files with 8 additions and 8 deletions

View File

@@ -804,17 +804,17 @@ namespace DICUI.Utilities
}
/// <summary>
/// Get the current system from drive letter
/// Get the current system from drive
/// </summary>
/// <param name="driveLetter"></param>
/// <param name="drive"></param>
/// <returns></returns>
public static KnownSystem? GetKnownSystem(char? driveLetter)
public static KnownSystem? GetKnownSystem(Drive drive)
{
// If no letter is provided, then we can't do anything
if (driveLetter == null)
// If drive or drive letter are provided, we can't do anything
if (drive?.Letter == null)
return null;
string drivePath = $"{driveLetter}:\\";
string drivePath = $"{drive.Letter}:\\";
// If we can't read the media in that drive, we can't do anything
if (!Directory.Exists(drivePath))
@@ -856,7 +856,7 @@ namespace DICUI.Utilities
}
// Sony PlayStation 4
if (File.Exists(Path.Combine(drivePath, "PSLogo.ico")))
if (drive.VolumeLabel.Equals("PS4VOLUME", StringComparison.OrdinalIgnoreCase))
{
return KnownSystem.SonyPlayStation4;
}

View File

@@ -341,7 +341,7 @@ namespace DICUI.Windows
if (!_options.SkipSystemDetection && index != -1)
{
ViewModels.LoggerViewModel.VerboseLog("Trying to detect system for drive {0}.. ", _drives[index].Letter);
var currentSystem = Validators.GetKnownSystem(_drives[index].Letter);
var currentSystem = Validators.GetKnownSystem(_drives[index]);
ViewModels.LoggerViewModel.VerboseLogLn(currentSystem == null || currentSystem == KnownSystem.NONE ? "unable to detect." : ("detected " + currentSystem.LongName() + "."));
if (currentSystem != null && currentSystem != KnownSystem.NONE)