Wire up the rest of saving. Save-as will now properly overwrite existing contents.

This commit is contained in:
Paul Chote
2010-12-30 16:11:45 +13:00
parent 39ed6087cb
commit 47bbc3a6de
5 changed files with 95 additions and 38 deletions

View File

@@ -23,19 +23,25 @@ namespace OpenRA.FileFormats
public ZipFile(string filename, int priority)
{
this.priority = priority;
if (File.Exists(filename))
try
{
try
{
pkg = new SZipFile(File.OpenRead(filename));
}
catch (ZipException e)
{
Log.Write("debug", "Couldn't load zip file: {0}", e.Message);
}
pkg = new SZipFile(File.OpenRead(filename));
}
else
pkg = SZipFile.Create(filename);
catch (ZipException e)
{
Log.Write("debug", "Couldn't load zip file: {0}", e.Message);
}
}
// Create a new zip with the specified contents
public ZipFile(string filename, int priority, Dictionary<string, byte[]> contents)
{
this.priority = priority;
if (File.Exists(filename))
File.Delete(filename);
pkg = SZipFile.Create(filename);
Write(contents);
}
public Stream GetContent(string filename)