mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2025-02-09 13:14:46 +01:00
hactoolnet: Savefile fixes
Only open as writable if needed Only commit if needed
This commit is contained in:
parent
7b8c3f0b4f
commit
b03973dc48
@ -14,7 +14,15 @@ namespace hactoolnet
|
|||||||
{
|
{
|
||||||
public static void Process(Context ctx)
|
public static void Process(Context ctx)
|
||||||
{
|
{
|
||||||
using (var file = new LocalStorage(ctx.Options.InFile, FileAccess.ReadWrite))
|
FileAccess accessNeeded = FileAccess.Read;
|
||||||
|
|
||||||
|
if (ctx.Options.SignSave || ctx.Options.ReplaceFileDest != null && ctx.Options.ReplaceFileSource != null ||
|
||||||
|
ctx.Options.RepackSource != null || ctx.Options.TrimSave)
|
||||||
|
{
|
||||||
|
accessNeeded = FileAccess.ReadWrite;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var file = new LocalStorage(ctx.Options.InFile, accessNeeded))
|
||||||
{
|
{
|
||||||
bool signNeeded = ctx.Options.SignSave;
|
bool signNeeded = ctx.Options.SignSave;
|
||||||
|
|
||||||
@ -86,7 +94,11 @@ namespace hactoolnet
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
save.Commit(ctx.Keyset);
|
if (signNeeded)
|
||||||
|
{
|
||||||
|
save.Commit(ctx.Keyset);
|
||||||
|
signNeeded = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.Options.TrimSave)
|
if (ctx.Options.TrimSave)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user