Unstatic GlobalFileSystem and rename it to FileSystem

Add a ModFiles field on ModData and move all access to the file system to go through that.
This commit is contained in:
Pavel Penev
2015-10-09 13:55:08 +03:00
parent 5684bcec1c
commit 1b88d24cfa
46 changed files with 154 additions and 172 deletions

View File

@@ -13,7 +13,6 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using OpenRA.FileSystem;
using OpenRA.Graphics;
namespace OpenRA.Mods.Common.UtilityCommands
@@ -32,7 +31,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
{
// HACK: The engine code assumes that Game.modData is set.
Game.ModData = modData;
GlobalFileSystem.LoadFromManifest(Game.ModData.Manifest);
modData.ModFiles.LoadFromManifest(Game.ModData.Manifest);
var imageField = typeof(TerrainTemplateInfo).GetField("Image");
var pickAnyField = typeof(TerrainTemplateInfo).GetField("PickAny");
@@ -56,7 +55,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
foreach (var ext in exts)
{
Stream s;
if (GlobalFileSystem.TryOpen(template.Images[0] + ext, out s))
if (modData.ModFiles.TryOpen(template.Images[0] + ext, out s))
s.Dispose();
else
continue;