Files
OpenRA/OpenRa.FileFormats/FileSystem.cs
Bob 4fa05a6d40 sequences for the rest of the buildable buildings, and fixes to make HBOX and MSLO work
- HBOX and MSLO sprites are in temperat/snow mixes with .tem/.sno extensions (and not present in interior)
2009-10-10 19:30:19 +13:00

46 lines
969 B
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using OpenRa.FileFormats;
namespace OpenRa.FileFormats
{
public static class FileSystem
{
static List<IFolder> mountedFolders = new List<IFolder>();
public static void Mount(IFolder folder)
{
mountedFolders.Add(folder);
}
public static Stream Open(string filename)
{
foreach( IFolder folder in mountedFolders )
{
Stream s = folder.GetContent(filename);
if( s != null )
return s;
}
throw new FileNotFoundException("File not found", filename);
}
public static Stream OpenWithExts( string filename, params string[] exts )
{
foreach( var ext in exts )
{
foreach( IFolder folder in mountedFolders )
{
Stream s = folder.GetContent( filename + ext );
if( s != null )
return s;
}
}
throw new FileNotFoundException( "File not found", filename );
}
}
}