-
Notifications
You must be signed in to change notification settings - Fork 2
/
PathSettings.cs
90 lines (80 loc) · 2.53 KB
/
PathSettings.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
///Borderlands Advanced Settings Tool
///Developed By Babak B. MDKv4
///Code Release Date: 9/12/2010
using System;
using System.IO;
namespace BorderlandsAdvancedConfig
{
public class PathSettings
{
private const string EngineIni = "WillowEngine.ini";
private const string InputIni = "WillowInput.ini";
private const string GameIni = "WillowGame.ini";
private const string GameConfigSubDir = "My Games\\Borderlands\\WillowGame\\Config";
private string DefaultSettingsDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), GameConfigSubDir);
public string EngineIniPath
{
get
{
return SettingsDir + Path.DirectorySeparatorChar + EngineIni;
}
}
public string InputIniPath
{
get
{
return SettingsDir + Path.DirectorySeparatorChar + InputIni;
}
}
public string GameIniPath
{
get
{
return SettingsDir + Path.DirectorySeparatorChar + GameIni;
}
}
private string _settingsDir;
public string SettingsDir
{
get
{
if (String.IsNullOrEmpty(_settingsDir))
{
if (Directory.Exists(DefaultSettingsDir))
{
_settingsDir = DefaultSettingsDir;
}
return _settingsDir;
}
else
{
return _settingsDir;
}
}
}
public bool SetSettingsDir(string SettingsDirectory)
{
try
{
string EngineCheck = SettingsDirectory + Path.DirectorySeparatorChar + EngineIni;
string InputCheck = SettingsDirectory + Path.DirectorySeparatorChar + InputIni;
string GameCheck = SettingsDirectory + Path.DirectorySeparatorChar + GameIni;
if (File.Exists(EngineCheck) && File.Exists(InputCheck) && File.Exists(GameCheck))
{
_settingsDir = SettingsDirectory;
return true;
}
else
{
_settingsDir = string.Empty;
return false;
}
}
catch
{
_settingsDir = string.Empty;
return false;
}
}
}
}