Make map saving independent of Container type. Saving zip/oramap/mix untested as the editor cannot load non-folder maps.

This commit is contained in:
Paul Chote
2010-12-29 11:39:26 +13:00
parent fa36c71023
commit c3ff679f3a
8 changed files with 73 additions and 81 deletions

View File

@@ -48,5 +48,31 @@ namespace OpenRA.FileFormats
{
get { return 500 + priority; }
}
public void Write(Dictionary<string, byte[]> contents)
{
pkg.BeginUpdate();
// TODO: Clear existing content?
foreach (var kvp in contents)
{
pkg.Add(new StaticMemoryDataSource(kvp.Value), kvp.Key);
}
pkg.CommitUpdate();
}
}
class StaticMemoryDataSource : IStaticDataSource
{
byte[] data;
public StaticMemoryDataSource (byte[] data)
{
this.data = data;
}
public Stream GetSource()
{
return new MemoryStream(data);
}
}
}