Use IReadOnlyFileSystem in MusicInfo.

This commit is contained in:
Paul Chote
2016-02-15 00:56:39 +00:00
parent 9978e20a83
commit a1bc70cb58
2 changed files with 5 additions and 4 deletions

View File

@@ -9,6 +9,7 @@
#endregion #endregion
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.FileSystem;
namespace OpenRA.GameRules namespace OpenRA.GameRules
{ {
@@ -33,13 +34,13 @@ namespace OpenRA.GameRules
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext; Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext;
} }
public void Load() public void Load(IReadOnlyFileSystem filesystem)
{ {
if (!Game.ModData.ModFiles.Exists(Filename)) if (!filesystem.Exists(Filename))
return; return;
Exists = true; Exists = true;
using (var s = Game.ModData.ModFiles.Open(Filename)) using (var s = filesystem.Open(Filename))
{ {
if (Filename.ToLowerInvariant().EndsWith("wav")) if (Filename.ToLowerInvariant().EndsWith("wav"))
Length = (int)WavLoader.WaveLength(s); Length = (int)WavLoader.WaveLength(s);

View File

@@ -182,7 +182,7 @@ namespace OpenRA
// Load music with map assets mounted // Load music with map assets mounted
using (new Support.PerfTimer("Map.Music")) using (new Support.PerfTimer("Map.Music"))
foreach (var entry in map.Rules.Music) foreach (var entry in map.Rules.Music)
entry.Value.Load(); entry.Value.Load(DefaultFileSystem);
VoxelProvider.Initialize(this, Manifest.VoxelSequences, map.VoxelSequenceDefinitions); VoxelProvider.Initialize(this, Manifest.VoxelSequences, map.VoxelSequenceDefinitions);
VoxelLoader.Finish(); VoxelLoader.Finish();