Rework IReadWritePackage interface.
This commit is contained in:
@@ -14,6 +14,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.FileFormats;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
@@ -95,7 +96,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Map.FixOpenAreas(Rules);
|
||||
|
||||
var dest = Path.GetFileNameWithoutExtension(args[1]) + ".oramap";
|
||||
var package = modData.ModFiles.CreatePackage(dest);
|
||||
var package = new ZipFile(modData.ModFiles, dest, true);
|
||||
Map.Save(package);
|
||||
Console.WriteLine(dest + " saved.");
|
||||
}
|
||||
|
||||
@@ -785,17 +785,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
yaml.Nodes.First(n => n.Key == "MapFormat").Value = new MiniYaml(Map.SupportedMapFormat.ToString());
|
||||
|
||||
var entries = new Dictionary<string, byte[]>();
|
||||
entries.Add("map.yaml", Encoding.UTF8.GetBytes(yaml.Nodes.WriteToString()));
|
||||
foreach (var file in package.Contents)
|
||||
{
|
||||
if (file == "map.yaml")
|
||||
continue;
|
||||
|
||||
entries.Add(file, package.GetStream(file).ReadAllBytes());
|
||||
}
|
||||
|
||||
package.Write(entries);
|
||||
package.Update("map.yaml", Encoding.UTF8.GetBytes(yaml.Nodes.WriteToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user