-
Notifications
You must be signed in to change notification settings - Fork 0
/
Version.cs
70 lines (66 loc) · 2.58 KB
/
Version.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
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace LSRVersionManager
{
public class Version
{
public string exeName;
public GameArgs whitelistArgs;
public GameArgs args;
public string cleanName;
public string number;
public string dateModified;
public string path;
public bool isDemo = false;
public Version(string gamePath)
{
string[] exeNames = { "_msr.exe", "LEGOSRally.exe", "StuntRally.exe" };
var flags0351 = ~GameArgs.None;
var flags0381 = GameArgs.Files | GameArgs.Freeform | GameArgs.IGTest | GameArgs.NoIntroVideo | GameArgs.XAFToXBF;
foreach (var exe in exeNames)
{
if(File.Exists(Path.Combine(gamePath, exe)))
{
FileInfo fileInfo = new FileInfo(Path.Combine(gamePath, exe));
FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine(gamePath, exe)); //TODO check file exists
path = gamePath;
this.number = fileVersionInfo.ProductVersion.Replace(", ", ".");
this.dateModified = fileInfo.LastWriteTime.ToString("F");
this.exeName = exe;
this.cleanName = "LEGO Stunt Rally";
if(this.exeName == "LEGOSRally.exe")
{
this.isDemo = true;
this.cleanName += " Japanese DEMO";
this.whitelistArgs = flags0381 & ~GameArgs.XAFToXBF | GameArgs.Res_Files | GameArgs.NoRes;
break;
}
else if(this.exeName == "StuntRally.exe")
{
this.isDemo = true;
this.cleanName += " English DEMO";
this.whitelistArgs = GameArgs.Freeform;
break;
}
this.cleanName += $" {this.number}";
if(this.number == "0.3.5.1")
{
this.whitelistArgs = flags0351;
}
else if (this.number == "0.3.8.1" || this.number == "0.3.7.7")
{
this.whitelistArgs = flags0381;
}
else
{
this.whitelistArgs = flags0351;
}
break;
}
}
}
}
}