Changed IFolder implementations' priorities to be based on listing order in mod.yaml
This commit is contained in:
@@ -21,9 +21,11 @@ namespace OpenRA.FileFormats
|
||||
readonly uint[] hashes;
|
||||
readonly Stream s;
|
||||
readonly ZipPackage pkg;
|
||||
int priority;
|
||||
|
||||
public CompressedPackage(string filename)
|
||||
public CompressedPackage(string filename, int priority)
|
||||
{
|
||||
this.priority = priority;
|
||||
s = FileSystem.Open(filename);
|
||||
pkg = (ZipPackage)ZipPackage.Open(s, FileMode.Open);
|
||||
hashes = pkg.GetParts()
|
||||
@@ -45,7 +47,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get { return 1; }
|
||||
get { return 500 + priority; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,14 +34,16 @@ namespace OpenRA.FileFormats
|
||||
}
|
||||
}
|
||||
|
||||
static int order = 0;
|
||||
|
||||
static IFolder OpenPackage(string filename)
|
||||
{
|
||||
if (filename.EndsWith(".mix"))
|
||||
return new Package(filename);
|
||||
return new Package(filename, order++);
|
||||
else if (filename.EndsWith(".zip"))
|
||||
return new CompressedPackage(filename);
|
||||
return new CompressedPackage(filename, order++);
|
||||
else
|
||||
return new Folder(filename);
|
||||
return new Folder(filename, order++);
|
||||
}
|
||||
|
||||
public static void Mount(string name)
|
||||
@@ -76,7 +78,7 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
var folder = index[PackageEntry.HashFilename(filename)]
|
||||
.Where(x => x.Exists(filename))
|
||||
.OrderByDescending(x => x.Priority)
|
||||
.OrderBy(x => x.Priority)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (folder != null)
|
||||
|
||||
@@ -17,7 +17,9 @@ namespace OpenRA.FileFormats
|
||||
{
|
||||
readonly string path;
|
||||
|
||||
public Folder(string path) { this.path = path; }
|
||||
int priority;
|
||||
|
||||
public Folder(string path, int priority) { this.path = path; this.priority = priority; }
|
||||
|
||||
public Stream GetContent(string filename)
|
||||
{
|
||||
@@ -39,7 +41,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get { return 100; }
|
||||
get { return priority; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,11 @@ namespace OpenRA.FileFormats
|
||||
readonly bool isRmix, isEncrypted;
|
||||
readonly long dataStart;
|
||||
readonly Stream s;
|
||||
int priority;
|
||||
|
||||
public Package(string filename)
|
||||
public Package(string filename, int priority)
|
||||
{
|
||||
this.priority = priority;
|
||||
s = FileSystem.Open(filename);
|
||||
|
||||
BinaryReader reader = new BinaryReader(s);
|
||||
@@ -154,7 +156,7 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get { return 0; }
|
||||
get { return 1000 + priority; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user