fix Tiberian Dawn CD rip logic

closes #4424
This commit is contained in:
Matthias Mailänder
2014-05-16 19:23:19 +02:00
parent 57a631c284
commit cc64b41246
3 changed files with 37 additions and 21 deletions

View File

@@ -44,18 +44,21 @@ namespace OpenRA
if (!Directory.Exists(destPath))
Directory.CreateDirectory(destPath);
if (!GlobalFileSystem.Exists(srcPath)) { onError("Cannot find " + package); return false; }
Log.Write("debug", "Mounting {0}".F(srcPath));
GlobalFileSystem.Mount(srcPath);
if (!GlobalFileSystem.Exists(package)) { onError("Cannot find " + package); return false; }
Log.Write("debug", "Mounting {0}".F(package));
GlobalFileSystem.Mount(package);
foreach (var s in files)
foreach (var file in files)
{
var destFile = Path.Combine(destPath, s);
using (var sourceStream = GlobalFileSystem.Open(s))
using (var destStream = File.Create(destFile))
var dest = Path.Combine(destPath, file);
if (File.Exists(dest))
File.Delete(dest);
using (var sourceStream = GlobalFileSystem.Open(file))
using (var destStream = File.Create(dest))
{
onProgress("Extracting " + s);
Log.Write("debug", "Extracting {0} to {1}".F(file, dest));
onProgress("Extracting " + file);
destStream.Write(sourceStream.ReadAllBytes());
}
}
@@ -75,8 +78,12 @@ namespace OpenRA
}
var destFile = Path.GetFileName(file).ToLowerInvariant();
onProgress("Extracting " + destFile);
File.Copy(fromPath, Path.Combine(destPath, destFile), true);
var dest = Path.Combine(destPath, destFile);
if (File.Exists(dest))
File.Delete(dest);
onProgress("Copying " + destFile);
Log.Write("debug", "Copy {0} to {1}".F(fromPath, dest));
File.Copy(fromPath, dest, true);
}
return true;