unify disk check between music install and game install for cnc
This commit is contained in:
@@ -46,13 +46,20 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
CheckForDisk();
|
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()
|
void CheckForDisk()
|
||||||
{
|
{
|
||||||
Func<string, bool> ValidDiskFilter = diskRoot => File.Exists(diskRoot+Path.DirectorySeparatorChar+"CONQUER.MIX") &&
|
var path = InstallUtils.GetMountedDisk(IsValidDisk);
|
||||||
File.Exists(diskRoot+Path.DirectorySeparatorChar+"DESERT.MIX") &&
|
|
||||||
File.Exists(new string[] { diskRoot, "INSTALL", "SETUP.Z" }.Aggregate(Path.Combine));
|
|
||||||
|
|
||||||
var path = InstallUtils.GetMountedDisk(ValidDiskFilter);
|
|
||||||
|
|
||||||
if (path != null)
|
if (path != null)
|
||||||
Install(path);
|
Install(path);
|
||||||
|
|||||||
@@ -215,11 +215,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
|
|
||||||
void CheckForDisk()
|
void CheckForDisk()
|
||||||
{
|
{
|
||||||
Func<string, bool> ValidDiskFilter = diskRoot => File.Exists(diskRoot+Path.DirectorySeparatorChar+"CONQUER.MIX") &&
|
var path = InstallUtils.GetMountedDisk(CncInstallFromCDLogic.IsValidDisk);
|
||||||
File.Exists(diskRoot+Path.DirectorySeparatorChar+"DESERT.MIX") &&
|
|
||||||
File.Exists(new string[] { diskRoot, "INSTALL", "SETUP.Z" }.Aggregate(Path.Combine));
|
|
||||||
|
|
||||||
var path = InstallUtils.GetMountedDisk(ValidDiskFilter);
|
|
||||||
|
|
||||||
if (path != null)
|
if (path != null)
|
||||||
Install(path);
|
Install(path);
|
||||||
|
|||||||
Reference in New Issue
Block a user