-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathProgram.cs
66 lines (57 loc) · 1.85 KB
/
Program.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
using System;
using System.IO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Reflection;
using NativeMessaging;
using System.Linq;
namespace GameSenseNativeMessaging
{
//TODO: REWRITE THIS AND SEE IF WE CAN CHECK THE USERNAME / DOMAIN
//IF: The extension detects a JDLF username, then set cookie (Logged in to JDLF account = true)
//IF: Disconnect happens or
class Program
{
static public string AssemblyLoadDirectory
{
get
{
string codeBase = Assembly.GetEntryAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}
static public string AssemblyExecuteablePath
{
get
{
string codeBase = Assembly.GetEntryAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
return Uri.UnescapeDataString(uri.Path);
}
}
static Host Host;
static GameSenseClient Client;
static string[] AllowedOrigins = new string[] { "chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/" };
static string Description = "Connects Chrome to the Steel Series GameSense Enginge, allowing websites to control hardware.";
static void Main(string[] args)
{
Client = new GameSenseClient();
Host = new ChromeHost(Client);
if (args.Contains("--register"))
{
Host.GenerateManifest(Description, AllowedOrigins);
Host.Register();
Client.Register();
} else if(args.Contains("--unregister"))
{
Host.UnRegister();
Client.UnRegister();
} else
{
Host.Listen();
}
}
}
}