Autodetect CD instead of prompting the user. Fixes #911. Requires testing under Windows and Linux.

This commit is contained in:
Paul Chote
2011-06-24 19:08:29 +12:00
parent dc9b0adba9
commit 24266ebc93
5 changed files with 203 additions and 138 deletions

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib;
using ICSharpCode.SharpZipLib.Zip;
@@ -26,6 +27,15 @@ namespace OpenRA.FileFormats
if (e != null) yield return e; else break;
}
}
public static string GetMountedDisk(string[] volumeNames)
{
var volumes = DriveInfo.GetDrives()
.Where(v => v.DriveType == DriveType.CDRom && v.IsReady)
.Select(v => v.RootDirectory.FullName);
return volumes.FirstOrDefault(v => volumeNames.Contains(Path.GetFileName(v)));
}
// TODO: The package should be mounted into its own context to avoid name collisions with installed files
public static bool ExtractFromPackage(string srcPath, string package, string[] files, string destPath, Action<string> onProgress, Action<string> onError)