-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathOverlayCommands.cs
83 lines (76 loc) · 2.52 KB
/
OverlayCommands.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
using Sync.Command;
using Sync.Tools;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Media;
namespace IngameOverlay
{
class OverlayCommands
{
private readonly Func<string, CommandDelegate, string, bool> cmdRegister;
public OverlayCommands(CommandManager manager)
{
cmdRegister = manager.Dispatch.bind;
cmdRegister("Overlay", Overlay, "Set in-game pp overlay properties");
cmdRegister("o", Overlay, "Set in-game pp overlay properties");
}
private void OverlayHelp(string value)
{
IO.CurrentIO.WriteHelp("i", "accept EUAL and start Injector");
IO.CurrentIO.WriteHelp("osu", "start osu! with overlay");
}
public static void i(string value)
{
Setting.GlobalConfig.WriteToMmf();
Setting.OverlayConfigs.WriteToMmf();
Setting.AcceptEula = true;
IO.CurrentIO.WriteColor("[Overlay]Waiting for osu to start.", ConsoleColor.Green);
OverlayLoader.Injcet();
}
public static void osu(string value)
{
if (!string.IsNullOrWhiteSpace(Setting.OsuExecPath) && File.Exists(Setting.OsuExecPath) &&
Setting.OsuExecPath.ToLower().EndsWith("osu!.exe"))
{
if (Setting.AcceptEula)
{
Setting.GlobalConfig.WriteToMmf();
Setting.OverlayConfigs.WriteToMmf();
Process.Start(Setting.OsuExecPath);
OverlayLoader.Injcet();
}
else
{
Sync.Tools.IO.DefaultIO.WriteColor("You have not accepted EULA.",ConsoleColor.Yellow);
}
}
else
{
Sync.Tools.IO.DefaultIO.WriteColor("Osu! Path error, please check the path!", ConsoleColor.Yellow);
}
}
private bool Overlay(Arguments arg)
{
Action<string> action = OverlayHelp;
switch (arg[0])
{
case "i":
action = i;
break;
case "osu":
action = osu;
break;
}
if (arg.Count == 2) action(arg[1]);
else action(string.Empty);
return true;
}
}
}