diff --git a/OpenRA.Game/FileSystem/BagFile.cs b/OpenRA.Game/FileSystem/BagFile.cs index 6de2349034..67ee2fdfcf 100644 --- a/OpenRA.Game/FileSystem/BagFile.cs +++ b/OpenRA.Game/FileSystem/BagFile.cs @@ -19,7 +19,7 @@ using OpenRA.Primitives; namespace OpenRA.FileSystem { - public sealed class BagFile : IFolder + public sealed class BagFile : IPackage { static readonly uint[] Nothing = { }; diff --git a/OpenRA.Game/FileSystem/BigFile.cs b/OpenRA.Game/FileSystem/BigFile.cs index 5482f05ac4..ec3dc977a4 100644 --- a/OpenRA.Game/FileSystem/BigFile.cs +++ b/OpenRA.Game/FileSystem/BigFile.cs @@ -15,7 +15,7 @@ using System.Linq; namespace OpenRA.FileSystem { - public sealed class BigFile : IFolder + public sealed class BigFile : IPackage { public string Name { get; private set; } public int Priority { get; private set; } diff --git a/OpenRA.Game/FileSystem/D2kSoundResources.cs b/OpenRA.Game/FileSystem/D2kSoundResources.cs index 2b74b133f2..852a5160b2 100644 --- a/OpenRA.Game/FileSystem/D2kSoundResources.cs +++ b/OpenRA.Game/FileSystem/D2kSoundResources.cs @@ -14,7 +14,7 @@ using System.IO; namespace OpenRA.FileSystem { - public sealed class D2kSoundResources : IFolder + public sealed class D2kSoundResources : IPackage { readonly Stream s; diff --git a/OpenRA.Game/FileSystem/FileSystem.cs b/OpenRA.Game/FileSystem/FileSystem.cs index 778f3f5f46..c4cc10e314 100644 --- a/OpenRA.Game/FileSystem/FileSystem.cs +++ b/OpenRA.Game/FileSystem/FileSystem.cs @@ -20,15 +20,15 @@ namespace OpenRA.FileSystem public class FileSystem { public readonly List FolderPaths = new List(); - public readonly List MountedFolders = new List(); + public readonly List MountedFolders = new List(); static readonly Dictionary AssemblyCache = new Dictionary(); int order; - Cache> crcHashIndex = new Cache>(_ => new List()); - Cache> classicHashIndex = new Cache>(_ => new List()); + Cache> crcHashIndex = new Cache>(_ => new List()); + Cache> classicHashIndex = new Cache>(_ => new List()); - public IFolder CreatePackage(string filename, int order, Dictionary content) + public IPackage CreatePackage(string filename, int order, Dictionary content) { if (filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase)) return new MixFile(this, filename, order, content); @@ -50,7 +50,7 @@ namespace OpenRA.FileSystem return new Folder(filename, order, content); } - public IFolder OpenPackage(string filename, string annotation, int order) + public IPackage OpenPackage(string filename, string annotation, int order) { if (filename.EndsWith(".mix", StringComparison.InvariantCultureIgnoreCase)) { @@ -81,7 +81,7 @@ namespace OpenRA.FileSystem return new Folder(filename, order); } - public void Mount(IFolder mount) + public void Mount(IPackage mount) { if (!MountedFolders.Contains(mount)) MountedFolders.Add(mount); @@ -105,26 +105,26 @@ namespace OpenRA.FileSystem a(); } - void MountInner(IFolder folder) + void MountInner(IPackage package) { - MountedFolders.Add(folder); + MountedFolders.Add(package); - foreach (var hash in folder.ClassicHashes()) + foreach (var hash in package.ClassicHashes()) { var folderList = classicHashIndex[hash]; - if (!folderList.Contains(folder)) - folderList.Add(folder); + if (!folderList.Contains(package)) + folderList.Add(package); } - foreach (var hash in folder.CrcHashes()) + foreach (var hash in package.CrcHashes()) { var folderList = crcHashIndex[hash]; - if (!folderList.Contains(folder)) - folderList.Add(folder); + if (!folderList.Contains(package)) + folderList.Add(package); } } - public bool Unmount(IFolder mount) + public bool Unmount(IPackage mount) { if (MountedFolders.Contains(mount)) mount.Dispose(); @@ -139,8 +139,8 @@ namespace OpenRA.FileSystem MountedFolders.Clear(); FolderPaths.Clear(); - classicHashIndex = new Cache>(_ => new List()); - crcHashIndex = new Cache>(_ => new List()); + classicHashIndex = new Cache>(_ => new List()); + crcHashIndex = new Cache>(_ => new List()); } public void LoadFromManifest(Manifest manifest) @@ -189,8 +189,8 @@ namespace OpenRA.FileSystem filename = divide.Last(); } - // Check the cache for a quick lookup if the folder name is unknown - // TODO: This disables caching for explicit folder requests + // Check the cache for a quick lookup if the package name is unknown + // TODO: This disables caching for explicit package requests if (filename.IndexOfAny(new char[] { '/', '\\' }) == -1 && !explicitFolder) { s = GetFromCache(PackageHashType.Classic, filename); @@ -203,15 +203,15 @@ namespace OpenRA.FileSystem } // Ask each package individually - IFolder folder; + IPackage package; if (explicitFolder && !string.IsNullOrEmpty(foldername)) - folder = MountedFolders.Where(x => x.Name == foldername).MaxByOrDefault(x => x.Priority); + package = MountedFolders.Where(x => x.Name == foldername).MaxByOrDefault(x => x.Priority); else - folder = MountedFolders.Where(x => x.Exists(filename)).MaxByOrDefault(x => x.Priority); + package = MountedFolders.Where(x => x.Exists(filename)).MaxByOrDefault(x => x.Priority); - if (folder != null) + if (package != null) { - s = folder.GetContent(filename); + s = package.GetContent(filename); return true; } diff --git a/OpenRA.Game/FileSystem/Folder.cs b/OpenRA.Game/FileSystem/Folder.cs index 1b62809d0d..920948b22e 100644 --- a/OpenRA.Game/FileSystem/Folder.cs +++ b/OpenRA.Game/FileSystem/Folder.cs @@ -13,7 +13,7 @@ using System.IO; namespace OpenRA.FileSystem { - public sealed class Folder : IFolder + public sealed class Folder : IPackage { readonly string path; readonly int priority; diff --git a/OpenRA.Game/FileSystem/IFolder.cs b/OpenRA.Game/FileSystem/IPackage.cs similarity index 94% rename from OpenRA.Game/FileSystem/IFolder.cs rename to OpenRA.Game/FileSystem/IPackage.cs index fa5aa4df87..226ba0bd62 100644 --- a/OpenRA.Game/FileSystem/IFolder.cs +++ b/OpenRA.Game/FileSystem/IPackage.cs @@ -14,7 +14,7 @@ using System.IO; namespace OpenRA.FileSystem { - public interface IFolder : IDisposable + public interface IPackage : IDisposable { Stream GetContent(string filename); bool Exists(string filename); diff --git a/OpenRA.Game/FileSystem/InstallShieldCABExtractor.cs b/OpenRA.Game/FileSystem/InstallShieldCABExtractor.cs index 8046394460..f4e8e22de0 100644 --- a/OpenRA.Game/FileSystem/InstallShieldCABExtractor.cs +++ b/OpenRA.Game/FileSystem/InstallShieldCABExtractor.cs @@ -17,7 +17,7 @@ using ICSharpCode.SharpZipLib.Zip.Compression; namespace OpenRA.FileSystem { - public sealed class InstallShieldCABExtractor : IFolder + public sealed class InstallShieldCABExtractor : IPackage { const uint FileSplit = 0x1; const uint FileObfuscated = 0x2; diff --git a/OpenRA.Game/FileSystem/InstallShieldPackage.cs b/OpenRA.Game/FileSystem/InstallShieldPackage.cs index 80127f936f..2355209ff4 100644 --- a/OpenRA.Game/FileSystem/InstallShieldPackage.cs +++ b/OpenRA.Game/FileSystem/InstallShieldPackage.cs @@ -15,7 +15,7 @@ using OpenRA.FileFormats; namespace OpenRA.FileSystem { - public sealed class InstallShieldPackage : IFolder + public sealed class InstallShieldPackage : IPackage { readonly Dictionary index = new Dictionary(); readonly List filenames; diff --git a/OpenRA.Game/FileSystem/MixFile.cs b/OpenRA.Game/FileSystem/MixFile.cs index bf65f4fc6d..0faaeb0c55 100644 --- a/OpenRA.Game/FileSystem/MixFile.cs +++ b/OpenRA.Game/FileSystem/MixFile.cs @@ -18,7 +18,7 @@ using OpenRA.Primitives; namespace OpenRA.FileSystem { - public sealed class MixFile : IFolder + public sealed class MixFile : IPackage { readonly Dictionary index; readonly long dataStart; diff --git a/OpenRA.Game/FileSystem/Pak.cs b/OpenRA.Game/FileSystem/Pak.cs index 51f69113f8..d3c0d7e764 100644 --- a/OpenRA.Game/FileSystem/Pak.cs +++ b/OpenRA.Game/FileSystem/Pak.cs @@ -21,7 +21,7 @@ namespace OpenRA.FileSystem public string Filename; } - public sealed class PakFile : IFolder + public sealed class PakFile : IPackage { readonly string filename; readonly int priority; diff --git a/OpenRA.Game/FileSystem/ZipFile.cs b/OpenRA.Game/FileSystem/ZipFile.cs index e82f5b9164..9699b0b216 100644 --- a/OpenRA.Game/FileSystem/ZipFile.cs +++ b/OpenRA.Game/FileSystem/ZipFile.cs @@ -17,7 +17,7 @@ using SZipFile = ICSharpCode.SharpZipLib.Zip.ZipFile; namespace OpenRA.FileSystem { - public sealed class ZipFile : IFolder + public sealed class ZipFile : IPackage { readonly string filename; readonly int priority; diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index f190c5b3f8..c7060c8e6b 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -157,7 +157,7 @@ namespace OpenRA [FieldLoader.Ignore] public readonly WVec[] SubCellOffsets; public readonly SubCell DefaultSubCell; public readonly SubCell LastSubCell; - [FieldLoader.Ignore] public IFolder Container; + [FieldLoader.Ignore] public IPackage Container; public string Path { get; private set; } // Yaml map data diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index a32c50975a..7b7f6bf06d 100644 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -96,7 +96,7 @@ - + diff --git a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs index 95653fc16c..e2b1e3b8f0 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs @@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic ScrollPanelWidget assetList; ScrollItemWidget template; - IFolder assetSource = null; + IPackage assetSource = null; List availableShps = new List(); bool animateFrames = false; @@ -334,7 +334,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic bool ShowSourceDropdown(DropDownButtonWidget dropdown) { - Func setupItem = (source, itemTemplate) => + Func setupItem = (source, itemTemplate) => { var item = ScrollItemWidget.Setup(itemTemplate, () => assetSource == source, @@ -344,7 +344,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic }; // TODO: Re-enable "All Packages" once list generation is done in a background thread - // var sources = new[] { (IFolder)null }.Concat(GlobalFileSystem.MountedFolders); + // var sources = new[] { (IPackage)null }.Concat(GlobalFileSystem.MountedFolders); var sources = Game.ModData.ModFiles.MountedFolders; dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 280, sources, setupItem); return true;