@@ -93,7 +93,7 @@ public ArchiveFileSystem(IFile headerFile, IFile dataFile)
93
93
94
94
public IDirectory OpenDirectory ( string path , OpenDirectoryMode mode )
95
95
{
96
- path = PathTools . Normalize ( path ) ;
96
+ path = PathTools . Normalize ( path ) . ToLowerInvariant ( ) ;
97
97
98
98
if ( ! FileTable . TryOpenDirectory ( path , out FindPosition position ) )
99
99
{
@@ -105,7 +105,7 @@ public IDirectory OpenDirectory(string path, OpenDirectoryMode mode)
105
105
106
106
public IFile OpenFile ( string path , OpenMode mode )
107
107
{
108
- path = PathTools . Normalize ( path ) ;
108
+ path = PathTools . Normalize ( path ) . ToLowerInvariant ( ) ;
109
109
110
110
if ( ! FileTable . TryOpenFile ( path , out RomFileInfo romFileInfo ) )
111
111
{
@@ -135,21 +135,21 @@ public IFile OpenFile(string path, OpenMode mode)
135
135
136
136
public bool DirectoryExists ( string path )
137
137
{
138
- path = PathTools . Normalize ( path ) ;
138
+ path = PathTools . Normalize ( path ) . ToLowerInvariant ( ) ;
139
139
140
140
return FileTable . TryOpenDirectory ( path , out FindPosition _ ) ;
141
141
}
142
142
143
143
public bool FileExists ( string path )
144
144
{
145
- path = PathTools . Normalize ( path ) ;
145
+ path = PathTools . Normalize ( path ) . ToLowerInvariant ( ) ;
146
146
147
147
return FileTable . TryOpenFile ( path , out RomFileInfo _ ) ;
148
148
}
149
149
150
150
public DirectoryEntryType GetEntryType ( string path )
151
151
{
152
- path = PathTools . Normalize ( path ) ;
152
+ path = PathTools . Normalize ( path ) . ToLowerInvariant ( ) ;
153
153
154
154
if ( FileExists ( path ) ) return DirectoryEntryType . File ;
155
155
if ( DirectoryExists ( path ) ) return DirectoryEntryType . Directory ;
@@ -223,6 +223,33 @@ public static void DecryptArh(byte[] file)
223
223
Buffer . BlockCopy ( filei , 0 , file , 0 , file . Length ) ;
224
224
}
225
225
226
+ public FileInfo GetFileInfo ( string filename )
227
+ {
228
+ int cur = 0 ;
229
+ Node curNode = Nodes [ cur ] ;
230
+
231
+ for ( int i = 0 ; i < filename . Length ; i ++ )
232
+ {
233
+ if ( curNode . Next < 0 ) break ;
234
+
235
+ int next = curNode . Next ^ char . ToLower ( filename [ i ] ) ;
236
+ Node nextNode = Nodes [ next ] ;
237
+ if ( nextNode . Prev != cur ) return null ;
238
+ cur = next ;
239
+ curNode = nextNode ;
240
+ }
241
+
242
+ int offset = - curNode . Next ;
243
+ while ( StringTable [ offset ] != 0 )
244
+ {
245
+ offset ++ ;
246
+ }
247
+ offset ++ ;
248
+
249
+ int fileId = BitConverter . ToInt32 ( StringTable , offset ) ;
250
+ return FileInfo [ fileId ] ;
251
+ }
252
+
226
253
private class Node
227
254
{
228
255
public int Next { get ; set ; }
0 commit comments