convert FileExtractor into a Utility cmdlet

This commit is contained in:
Chris Forbes
2011-09-11 17:13:43 +12:00
parent 03adb7f2c3
commit 21ae6ee983
10 changed files with 25 additions and 152 deletions

View File

@@ -128,5 +128,24 @@ namespace OpenRA.Utility
ShpWriter.Write(destStream, size.Width, size.Height,
srcImage.Select( im => im.Image ));
}
public static void ExtractFiles(string[] args)
{
var mods = args[1].Split(',');
var files = args.Skip(2);
var manifest = new Manifest(mods);
FileSystem.LoadFromManifest(manifest);
foreach( var f in files )
{
var src = FileSystem.Open(f);
if (src == null)
throw new InvalidOperationException("File not found: {0}".F(f));
var data = src.ReadAllBytes();
File.WriteAllBytes( f, data );
}
}
}
}