less ../../../
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1355 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
@@ -17,9 +17,12 @@ namespace OpenRa.FileFormats
|
||||
|
||||
public static Stream Open(string filename)
|
||||
{
|
||||
foreach (IFolder folder in mountedFolders)
|
||||
try { return folder.GetContent(filename); }
|
||||
catch { }
|
||||
foreach( IFolder folder in mountedFolders )
|
||||
{
|
||||
Stream s = folder.GetContent(filename);
|
||||
if( s != null )
|
||||
return s;
|
||||
}
|
||||
|
||||
throw new FileNotFoundException("File not found", filename);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace OpenRa.FileFormats
|
||||
public Stream GetContent(string filename)
|
||||
{
|
||||
try { return File.OpenRead(path + filename); }
|
||||
catch { throw new FileNotFoundException("File not found", filename); }
|
||||
catch { return null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRa.FileFormats
|
||||
public Package(string filename)
|
||||
{
|
||||
this.filename = filename;
|
||||
using (Stream s = File.OpenRead(filename))
|
||||
using (Stream s = FileSystem.Open(filename))
|
||||
{
|
||||
BinaryReader reader = new BinaryReader(s);
|
||||
uint signature = reader.ReadUInt32();
|
||||
@@ -124,7 +124,7 @@ namespace OpenRa.FileFormats
|
||||
foreach( PackageEntry e in index )
|
||||
if (e.Hash == hash)
|
||||
{
|
||||
using (Stream s = File.OpenRead(filename))
|
||||
using (Stream s = FileSystem.Open(filename))
|
||||
{
|
||||
s.Seek( dataStart + e.Offset, SeekOrigin.Begin );
|
||||
byte[] data = new byte[ e.Length ];
|
||||
@@ -133,19 +133,12 @@ namespace OpenRa.FileFormats
|
||||
}
|
||||
}
|
||||
|
||||
throw new FileNotFoundException();
|
||||
return null;
|
||||
}
|
||||
|
||||
public Stream GetContent(string filename)
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetContent(PackageEntry.HashFilename(filename));
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
throw new FileNotFoundException("File not found", filename, e);
|
||||
}
|
||||
return GetContent(PackageEntry.HashFilename(filename));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRa.FileFormats
|
||||
Walkability walkability = new Walkability();
|
||||
|
||||
char tileSetChar = char.ToUpperInvariant( suffix[ 1 ] );
|
||||
StreamReader tileIdFile = File.OpenText( "../../../tileSet.til" );
|
||||
StreamReader tileIdFile = new StreamReader( FileSystem.Open( "tileSet.til" ) );
|
||||
|
||||
while( true )
|
||||
{
|
||||
|
||||
@@ -8,14 +8,12 @@ namespace OpenRa.FileFormats
|
||||
{
|
||||
public class Walkability
|
||||
{
|
||||
const string src = "../../../templates.ini";
|
||||
|
||||
Dictionary<string, Dictionary<int, int>> walkability =
|
||||
new Dictionary<string, Dictionary<int, int>>();
|
||||
|
||||
public Walkability()
|
||||
{
|
||||
IniFile file = new IniFile(File.OpenRead(src));
|
||||
IniFile file = new IniFile( FileSystem.Open( "templates.ini" ) );
|
||||
Regex pattern = new Regex(@"tiletype(\d+)");
|
||||
|
||||
foreach (IniSection section in file.Sections)
|
||||
|
||||
Reference in New Issue
Block a user