diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs index b2428e96b0..0c599ba566 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncInstallFromCDLogic.cs @@ -46,13 +46,20 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic CheckForDisk(); } + public static bool IsValidDisk(string diskRoot) + { + var files = new string[][] { + new [] { diskRoot, "CONQUER.MIX" }, + new [] { diskRoot, "DESERT.MIX" }, + new [] { diskRoot, "INSTALL", "SETUP.Z" }, + }; + + return files.All(f => File.Exists(f.Aggregate(Path.Combine))); + } + void CheckForDisk() { - Func ValidDiskFilter = diskRoot => File.Exists(diskRoot+Path.DirectorySeparatorChar+"CONQUER.MIX") && - File.Exists(diskRoot+Path.DirectorySeparatorChar+"DESERT.MIX") && - File.Exists(new string[] { diskRoot, "INSTALL", "SETUP.Z" }.Aggregate(Path.Combine)); - - var path = InstallUtils.GetMountedDisk(ValidDiskFilter); + var path = InstallUtils.GetMountedDisk(IsValidDisk); if (path != null) Install(path); diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs index fc091a59ac..60f072aaaf 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncMusicPlayerLogic.cs @@ -215,11 +215,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic void CheckForDisk() { - Func ValidDiskFilter = diskRoot => File.Exists(diskRoot+Path.DirectorySeparatorChar+"CONQUER.MIX") && - File.Exists(diskRoot+Path.DirectorySeparatorChar+"DESERT.MIX") && - File.Exists(new string[] { diskRoot, "INSTALL", "SETUP.Z" }.Aggregate(Path.Combine)); - - var path = InstallUtils.GetMountedDisk(ValidDiskFilter); + var path = InstallUtils.GetMountedDisk(CncInstallFromCDLogic.IsValidDisk); if (path != null) Install(path);