@@ -10,24 +10,43 @@ namespace RA3.Tools
10
10
{
11
11
public class RA3Instance
12
12
{
13
+ /// <summary>
14
+ /// Private pre-defined name of QuickLoader.
15
+ /// </summary>
16
+ /// TODO: Download to AppData automatically.
13
17
private static readonly string _quickLoaderPath = "RA3.QuickLoader.exe" ;
14
- //
18
+
19
+ /// <summary>
20
+ /// Game install folder.
21
+ /// </summary>
15
22
public string GamePath ;
23
+
24
+ /// <summary>
25
+ /// Parameter passes to game.
26
+ /// </summary>
16
27
public string LaunchParamter ;
28
+
29
+ /// <summary>
30
+ /// Whether to use RA3BarLauncher to launch game.
31
+ /// </summary>
17
32
public bool UseBarLauncher ;
33
+
34
+ /// <summary>
35
+ /// Avaliable profiles of game user.
36
+ /// </summary>
18
37
public List < string > Profiles
19
38
{
20
39
get { return GetProfilesList ( ) ; }
21
40
}
22
- //
23
41
public readonly ResourceFolder ModFolder = new ResourceFolder ( Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . MyDocuments ) , "Red Alert 3" , "Mods" ) ) ;
24
42
public readonly ResourceFolder ReplayFolder = new ResourceFolder ( Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . MyDocuments ) , "Red Alert 3" , "Replays" ) ) ;
25
43
public readonly ResourceFolder MapFolder = new ResourceFolder ( Path . Combine ( Environment . GetEnvironmentVariable ( "appdata" ) , "Red Alert 3" , "Maps" ) ) ;
26
44
public readonly ResourceFolder ProfileFolder = new ResourceFolder ( Path . Combine ( Environment . GetEnvironmentVariable ( "appdata" ) , "Red Alert 3" , "Profiles" ) ) ;
45
+
27
46
/// <summary>
28
- /// 红警3进程实例
47
+ /// Red-Alert 3 Game Instance.
29
48
/// </summary>
30
- /// <param name="gamePath">游戏路径(可选,为空则从注册表读取) </param>
49
+ /// <param name="gamePath">Game install folder. Will Read from Registry if empty. </param>
31
50
public RA3Instance ( string gamePath = "" )
32
51
{
33
52
//Read GamePath
@@ -39,8 +58,8 @@ public RA3Instance(string gamePath = "")
39
58
{
40
59
GamePath = gamePath ;
41
60
}
42
- //Check RA3.QuickLoader
43
- if ( File . Exists ( $ ". \\ { _quickLoaderPath } " ) )
61
+ //Check if RA3.QuickLoader is avaliable.
62
+ if ( File . Exists ( Path . GetFullPath ( _quickLoaderPath ) ) )
44
63
{
45
64
UseBarLauncher = true ;
46
65
}
@@ -59,7 +78,7 @@ public bool IsRA3PathValid()
59
78
60
79
public bool IsRA3FileValid ( )
61
80
{
62
- return false ;
81
+ throw new NotImplementedException ( ) ;
63
82
}
64
83
#endregion
65
84
@@ -82,7 +101,7 @@ public static void LaunchUsingSkudef(string executablePath, string skudefPath)
82
101
83
102
public void Register ( )
84
103
{
85
- if ( IsRA3PathValid ( ) && IsRA3FileValid ( ) && Registry . Status != Registry . RegistryStatus . Correct )
104
+ if ( IsRA3PathValid ( ) && Registry . Status != Registry . RegistryStatus . Correct )
86
105
{
87
106
Registry . SetRA3Path ( GamePath ) ;
88
107
Registry . EnableMapSync ( ) ;
@@ -156,7 +175,11 @@ public void _GeneratePatchedParFile()
156
175
#endregion
157
176
158
177
#region Profile Operations
159
- // Parse string encoded by EA similar to UTF-8 in directory.ini
178
+ /// <summary>
179
+ /// Parse string encoded by EA similar to UTF-8 in directory.ini
180
+ /// </summary>
181
+ /// <param name="s">string</param>
182
+ /// <returns></returns>
160
183
private string ParseDirectoryString ( string s )
161
184
{
162
185
var bytes = new List < byte > ( ) ;
@@ -177,7 +200,10 @@ private string ParseDirectoryString(string s)
177
200
}
178
201
return Encoding . Unicode . GetString ( bytes . ToArray ( ) ) ;
179
202
}
180
-
203
+ /// <summary>
204
+ /// Get list of avaliable profiles list.
205
+ /// </summary>
206
+ /// <returns>List of avaliable game profiles.</returns>
181
207
private List < string > GetProfilesList ( )
182
208
{
183
209
var original = ParseDirectoryString ( File . ReadAllLines ( $ "{ ProfileFolder . Path } \\ directory.ini") [ 0 ] ) ;
0 commit comments