-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSteamConfigFile.cs
59 lines (54 loc) · 2.11 KB
/
SteamConfigFile.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace VDF {
public class SteamConfigFile: VDFFile {
public SteamConfigFile(string file_name) : base(file_name) { }
public List<String> BaseInstallFolders {
get {
List<String> folders = new List<string>();
NestedElement sele = SteamElement;
if (sele != null) {
foreach (String name in sele.Children.Keys) {
if (name.StartsWith("BaseInstallFolder")) {
folders.Add(DeEscapeString(sele.Children[name].Value));
}
}
}
return folders;
}
}
public Dictionary<String,SteamAccount> Users {
get {
Dictionary<String, SteamAccount> users = new Dictionary<String, SteamAccount>();
NestedElement sele = SteamElement;
if (sele != null && sele.Children.ContainsKey("Accounts")) {
NestedElement uele = sele.Children["Accounts"];
foreach (string name in uele.Children.Keys) {
users.Add(name, new SteamAccount(uele.Children[name]));
}
}
return users;
}
}
public NestedElement SteamElement {
get {
if (Elements.ContainsKey("InstallConfigStore")) {
NestedElement ele = Elements["InstallConfigStore"];
if (ele.Children.ContainsKey("Software")) {
ele = ele.Children["Software"];
if (ele.Children.ContainsKey("Valve")) {
ele = ele.Children["Valve"];
if (ele.Children.ContainsKey("Steam")) {
ele = ele.Children["Steam"];
return ele;
}
}
}
}
return null;
}
}
}
}