/
CustomGameVersion.cs
68 lines (50 loc) · 2.24 KB
/
CustomGameVersion.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System.IO;
using System.Xml;
using GameSaveInfo;
using MASGAU.Location;
using MASGAU.Location.Holders;
namespace MASGAU {
public class CustomGameVersion : GameVersion {
public CustomGameVersion(GameSaveInfo.Game parent, DirectoryInfo location, string saves, string ignores)
: base(parent, "Windows", null, "Custom") {
DetectedLocations locs = Core.locations.interpretPath(location.FullName);
DetectedLocationPathHolder loc = locs.getMostAccurateLocation();
if (loc.EV == EnvironmentVariable.VirtualStore) {
string drive = Path.GetPathRoot(loc.FullDirPath);
string new_path = Path.Combine(drive, loc.Path);
loc = Core.locations.interpretPath(new_path).getMostAccurateLocation();
}
switch (loc.EV) {
case EnvironmentVariable.ProgramFiles:
case EnvironmentVariable.ProgramFilesX86:
case EnvironmentVariable.Drive:
loc.EV = EnvironmentVariable.InstallLocation;
break;
}
LocationPath locpath = new LocationPath(this.Locations, loc.EV, loc.Path);
this.Locations.Paths.Add(locpath);
FileType type = this.addFileType("Custom");
string path, file;
Include save;
if (saves != null && ignores != "") {
path = Path.GetDirectoryName(saves);
file = Path.GetFileName(saves);
save = type.addSave(path, file);
} else {
save = type.addSave(null, null);
}
if (ignores != null && ignores != "") {
path = Path.GetDirectoryName(ignores);
file = Path.GetFileName(ignores);
Exclude except = save.addExclusion(path, file);
}
if (Core.settings.EmailSender != null)
this.Contributors.Add(Core.settings.EmailSender);
else
this.Contributors.Add("Anonymous");
}
public CustomGameVersion(GameSaveInfo.Game parent, XmlElement element)
: base(parent, element) {
}
}
}