Remove unused leftover oramod loading code.

This commit is contained in:
Paul Chote
2017-05-01 18:11:31 +01:00
parent 248c12827e
commit 9b4f602cca
2 changed files with 19 additions and 14 deletions

View File

@@ -51,6 +51,22 @@ namespace OpenRA.FileSystem
return combined.StartsWith(path, StringComparison.Ordinal) && File.Exists(combined); return combined.StartsWith(path, StringComparison.Ordinal) && File.Exists(combined);
} }
public IReadOnlyPackage OpenPackage(string filename, FileSystem context)
{
var subFolder = Platform.ResolvePath(Path.Combine(Name, filename));
if (Directory.Exists(subFolder))
return new Folder(subFolder);
// Other package types can be loaded normally
IReadOnlyPackage package;
var s = GetStream(filename);
if (context.TryParsePackage(s, filename, out package))
return package;
s.Dispose();
return null;
}
public void Update(string filename, byte[] contents) public void Update(string filename, byte[] contents)
{ {
// HACK: ZipFiles can't be loaded as read-write from a stream, so we are // HACK: ZipFiles can't be loaded as read-write from a stream, so we are

View File

@@ -68,21 +68,10 @@ namespace OpenRA
IReadOnlyPackage package = null; IReadOnlyPackage package = null;
try try
{ {
if (Directory.Exists(path)) if (!Directory.Exists(path))
package = new Folder(path); throw new InvalidDataException(path + " is not a valid mod package");
else
{
try
{
using (var fileStream = File.OpenRead(path))
package = new ZipFile(fileStream, path);
}
catch
{
throw new InvalidDataException(path + " is not a valid mod package");
}
}
package = new Folder(path);
if (!package.Contains("mod.yaml")) if (!package.Contains("mod.yaml"))
throw new InvalidDataException(path + " is not a valid mod package"); throw new InvalidDataException(path + " is not a valid mod package");