mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-10-01 13:26:39 -05:00
Update backup/restore feature
trycatch the restoration action, and force overwriting https://projectpokemon.org/forums/forums/topic/34377-pk3ds-xyoras-rom-editor-randomizer/?page=37#comment-213548
This commit is contained in:
@@ -142,13 +142,13 @@ private static int restoreExeFS(GameConfig config, string bak_exefs)
|
||||
{
|
||||
int count = 0;
|
||||
var files = Directory.GetFiles(config.ExeFS);
|
||||
foreach (var f in files)
|
||||
foreach (var src in files)
|
||||
{
|
||||
string dest = Path.Combine(bak_exefs, Path.GetFileName(f));
|
||||
string dest = Path.Combine(bak_exefs, Path.GetFileName(src));
|
||||
if (File.Exists(dest))
|
||||
{
|
||||
File.Copy(dest, f);
|
||||
count++;
|
||||
try { File.Copy(dest, src, overwrite: true); count++; }
|
||||
catch { Console.WriteLine("Unable to overwrite backup: " + dest); }
|
||||
}
|
||||
else
|
||||
Console.WriteLine("Unable to find backup: " + dest);
|
||||
@@ -167,8 +167,8 @@ private static int restoreGARC(GameConfig config, string bak_a)
|
||||
string dest = Path.Combine(bak_a, name);
|
||||
if (File.Exists(dest))
|
||||
{
|
||||
File.Copy(dest, src);
|
||||
count++;
|
||||
try { File.Copy(dest, src, overwrite: true); count++; }
|
||||
catch { Console.WriteLine("Unable to overwrite backup: " + dest); }
|
||||
}
|
||||
else
|
||||
Console.WriteLine("Unable to find backup: " + dest);
|
||||
@@ -195,8 +195,8 @@ private static int restoreDLL(GameConfig config, string bak_dll)
|
||||
string dest = Path.Combine(bak_dll, Path.GetFileName(src));
|
||||
if (File.Exists(dest))
|
||||
{
|
||||
File.Copy(dest, src);
|
||||
count++;
|
||||
try { File.Copy(dest, src, overwrite: true); count++; }
|
||||
catch { Console.WriteLine("Unable to overwrite backup: " + dest); }
|
||||
}
|
||||
else
|
||||
Console.WriteLine("Unable to find backup: " + dest);
|
||||
|
||||
Reference in New Issue
Block a user