-
Notifications
You must be signed in to change notification settings - Fork 1
/
VirtualCard.cs
49 lines (41 loc) · 1.4 KB
/
VirtualCard.cs
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using GC_MemoryCard_Reader.Parsers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GC_MemoryCard_Reader
{
/// <summary>
/// This class represents a Nintendo GameCube MemoryCard.
/// </summary>
internal class VirtualCard
{
private readonly MemoryCard.BlockAllocationMap _allocationMap;
private readonly ICollection<MemoryCard.SaveGame> saves;
public MemoryCard.Header Header { get; internal set; }
public MemoryCard.Directory Directory { get; internal set; }
public MemoryCard.Directory DirectoryBackup { get; internal set; }
public static VirtualCard FromPath(string path)
{
var parser = new RawParser(path);
return new VirtualCard()
{
Header = parser.ExtractHeader(),
Directory = parser.ExtractDirectory(),
DirectoryBackup = parser.ExtractDirectory(MemoryCard.DirectoryType.Backup)
};
}
public override string ToString()
{
StringBuilder sb = new();
sb.Append(Header.ToString());
sb.Append(Directory.ToString());
sb.AppendLine();
sb.AppendLine("--Backup--");
sb.Append(DirectoryBackup.ToString());
sb.AppendLine();
return sb.ToString();
}
}
}