mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-08-01 17:23:58 -05:00
Update ExeFS.cs
This commit is contained in:
parent
88e64592e7
commit
bd65499b07
|
|
@ -9,26 +9,25 @@ namespace pk3DS.Core.CTR;
|
|||
public class ExeFS
|
||||
{
|
||||
public byte[] Data;
|
||||
public byte[] SuperBlockHash;
|
||||
public readonly byte[] SuperBlockHash;
|
||||
|
||||
// Return an object with data stored in a byte array
|
||||
public ExeFS(string EXEFS_PATH)
|
||||
public ExeFS(string path)
|
||||
{
|
||||
if (Directory.Exists(EXEFS_PATH))
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
var files = new DirectoryInfo(EXEFS_PATH).GetFiles().Select(f => f.FullName).ToArray();
|
||||
var files = new DirectoryInfo(path).GetFiles().Select(f => f.FullName).ToArray();
|
||||
SetData(files);
|
||||
}
|
||||
else if (File.Exists(path))
|
||||
{
|
||||
Data = File.ReadAllBytes(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
Data = File.ReadAllBytes(EXEFS_PATH);
|
||||
throw new FileNotFoundException("File not found.", path);
|
||||
}
|
||||
GetSuperBlockHash();
|
||||
}
|
||||
|
||||
public void GetSuperBlockHash()
|
||||
{
|
||||
SHA256.HashData(Data.AsSpan(0, 200), SuperBlockHash);
|
||||
SuperBlockHash = SHA256.HashData(Data.AsSpan(0, 200));
|
||||
}
|
||||
|
||||
// Overall R/W files (wrapped)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user