mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Merge pull request #8 from CaitSith2/master
Stop converting all names to uppercase. Fix CombinationStream seeking.
This commit is contained in:
commit
12fbc1484c
4 changed files with 31 additions and 6 deletions
|
@ -115,7 +115,7 @@ namespace DiscUtils.Fat
|
|||
|
||||
if (_position > _length)
|
||||
{
|
||||
throw new IOException("Attempt to read beyond end of file");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (count < 0)
|
||||
|
|
|
@ -414,7 +414,7 @@ namespace DiscUtils.Fat
|
|||
validChecksum = false;
|
||||
break;
|
||||
}
|
||||
sb.Append(slot.Name.ToUpperInvariant());
|
||||
sb.Append(slot.Name);
|
||||
}
|
||||
|
||||
if (validChecksum)
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System.IO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace LibHac
|
||||
{
|
||||
|
@ -23,12 +25,12 @@ namespace LibHac
|
|||
|
||||
public Stream OpenFile(string path, FileMode mode)
|
||||
{
|
||||
return new FileStream(path, mode);
|
||||
return new FileStream(Path.Combine(Root, path), mode);
|
||||
}
|
||||
|
||||
public Stream OpenFile(string path, FileMode mode, FileAccess access)
|
||||
{
|
||||
return new FileStream(path, mode, access);
|
||||
return new FileStream(Path.Combine(Root, path), mode, access);
|
||||
}
|
||||
|
||||
public string[] GetFileSystemEntries(string path, string searchPattern)
|
||||
|
@ -38,7 +40,29 @@ namespace LibHac
|
|||
|
||||
public string[] GetFileSystemEntries(string path, string searchPattern, SearchOption searchOption)
|
||||
{
|
||||
return Directory.GetFileSystemEntries(Path.Combine(Root, path), searchPattern, searchOption);
|
||||
//return Directory.GetFileSystemEntries(Path.Combine(Root, path), searchPattern, searchOption);
|
||||
var result = new List<string>();
|
||||
|
||||
try
|
||||
{
|
||||
result.AddRange(GetFileSystemEntries(Path.Combine(Root, path), searchPattern));
|
||||
}
|
||||
catch (UnauthorizedAccessException) { /* Skip this directory */ }
|
||||
|
||||
if (searchOption == SearchOption.TopDirectoryOnly)
|
||||
return result.ToArray();
|
||||
|
||||
var searchDirectories = Directory.GetDirectories(Path.Combine(Root, path));
|
||||
foreach (var search in searchDirectories)
|
||||
{
|
||||
try
|
||||
{
|
||||
result.AddRange(GetFileSystemEntries(search, searchPattern, searchOption));
|
||||
}
|
||||
catch (UnauthorizedAccessException) { /* Skip this result */ }
|
||||
}
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
public string GetFullPath(string path)
|
||||
|
|
|
@ -126,6 +126,7 @@ namespace LibHac.Streams
|
|||
break;
|
||||
|
||||
_currentStream = _streams[_currentStreamIndex++];
|
||||
_currentStream.Position = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue