-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomEngine.cs
More file actions
58 lines (56 loc) · 1.8 KB
/
CustomEngine.cs
File metadata and controls
58 lines (56 loc) · 1.8 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace FNF_Launcher
{
public class CustomEngine
{
public string name;
public string repo;
public int? platformNum;
public string executable; // this is basically whether its "PsychEngine/PsychEngine.exe" or "FunkinFPSPlus/FPS Plus.exe" etc.
public CustomEngine(string path)
{
string engine = File.ReadAllText(path);
foreach (string line in engine.Split("\n"))
{
string[] prop = line.Split("=");
if (prop[0] == "name")
{
name = prop[1];
}
if (prop[0] == "repo")
{
repo = prop[1];
}
if (prop[0] == "platformNum")
{
platformNum = int.Parse(prop[1]);
}
if (prop[0] == "executable")
{
executable = prop[1];
}
}
if (name == null)
{
name = Path.GetFileNameWithoutExtension(path);
}
if (repo == null)
{
throw new ArgumentNullException(nameof(repo), $"Instance '{name}' is missing property 'repo'");
}
if (platformNum == null)
{
throw new ArgumentNullException(nameof(platformNum), $"Instance '{platformNum}' is missing property 'platformNum'");
}
if (executable == null)
{
throw new ArgumentNullException(nameof(executable), $"Instance '{executable}' is missing property 'executable'");
}
}
}
}