forked from Rafacasari/GamedataLib.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSaveInstance.cs
More file actions
33 lines (24 loc) · 907 Bytes
/
SaveInstance.cs
File metadata and controls
33 lines (24 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using GamedataLibNET.Sav;
namespace GamedataLibNET;
public class SaveInstance
{
public static SaveInstance FromFolder(string folder) => new(folder);
public SavFile Player { get; set; }
public SavFile Mii { get; set; }
public SavFile Map { get; set; }
public string Folder { get; }
public SaveInstance(string folder)
{
if (string.IsNullOrEmpty(folder))
throw new ArgumentException("Folder cannot be null or empty.", nameof(folder));
if (!Directory.Exists(folder))
throw new Exception("Folder does not exist.");
Folder = folder;
var playerSave = Path.Combine(folder, "Player.sav");
var miiSave = Path.Combine(folder, "Mii.sav");
var mapSave = Path.Combine(folder, "Map.sav");
Player = new SavFile(playerSave);
Mii = new SavFile(miiSave);
Map = new SavFile(mapSave);
}
}