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

@@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
this.world = world;
panel = widget;
assetSource = GlobalFileSystem.MountedFolders.First();
assetSource = Game.ModData.ModFiles.MountedFolders.First();
var ticker = panel.GetOrNull<LogicTickerWidget>("ANIMATION_TICKER");
if (ticker != null)
@@ -306,7 +306,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (string.IsNullOrEmpty(filename))
return false;
if (!GlobalFileSystem.Exists(filename))
if (!Game.ModData.ModFiles.Exists(filename))
return false;
if (Path.GetExtension(filename.ToLowerInvariant()) == ".vqa")
@@ -345,7 +345,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 = GlobalFileSystem.MountedFolders;
var sources = Game.ModData.ModFiles.MountedFolders;
dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 280, sources, setupItem);
return true;
}

View File

@@ -10,7 +10,6 @@
#endregion
using System;
using OpenRA.FileSystem;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
@@ -32,7 +31,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var template = scrollPanel.Get<LabelWidget>("CREDITS_TEMPLATE");
scrollPanel.RemoveChildren();
var lines = GlobalFileSystem.Open("AUTHORS").ReadAllLines();
var lines = Game.ModData.ModFiles.Open("AUTHORS").ReadAllLines();
foreach (var l in lines)
{
// Improve the formatting

View File

@@ -14,7 +14,6 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Threading;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Network;
using OpenRA.Widgets;
@@ -171,11 +170,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var briefingVideo = selectedMapPreview.Map.Videos.Briefing;
var briefingVideoVisible = briefingVideo != null;
var briefingVideoDisabled = !(briefingVideoVisible && GlobalFileSystem.Exists(briefingVideo));
var briefingVideoDisabled = !(briefingVideoVisible && Game.ModData.ModFiles.Exists(briefingVideo));
var infoVideo = selectedMapPreview.Map.Videos.BackgroundInfo;
var infoVideoVisible = infoVideo != null;
var infoVideoDisabled = !(infoVideoVisible && GlobalFileSystem.Exists(infoVideo));
var infoVideoDisabled = !(infoVideoVisible && Game.ModData.ModFiles.Exists(infoVideo));
startBriefingVideoButton.IsVisible = () => briefingVideoVisible && playingVideo != PlayingVideo.Briefing;
startBriefingVideoButton.IsDisabled = () => briefingVideoDisabled || playingVideo != PlayingVideo.None;
@@ -295,7 +294,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return;
var gameStartVideo = selectedMapPreview.Map.Videos.GameStart;
if (gameStartVideo != null && GlobalFileSystem.Exists(gameStartVideo))
if (gameStartVideo != null && Game.ModData.ModFiles.Exists(gameStartVideo))
{
var fsPlayer = fullscreenVideoPlayer.Get<VqaPlayerWidget>("PLAYER");
fullscreenVideoPlayer.Visible = true;

View File

@@ -11,7 +11,6 @@
using System;
using System.Drawing;
using OpenRA.FileFormats;
using OpenRA.FileSystem;
using OpenRA.Graphics;
using OpenRA.Widgets;
@@ -50,7 +49,7 @@ namespace OpenRA.Mods.Common.Widgets
{
if (filename == cachedVideo)
return;
var video = new VqaReader(GlobalFileSystem.Open(filename));
var video = new VqaReader(Game.ModData.ModFiles.Open(filename));
cachedVideo = filename;
Open(video);