-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
50 lines (43 loc) · 1.32 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
using obs_cli.Data;
using obs_cli.Objects;
using obs_cli.Services;
using System;
namespace obs_cli
{
class Program
{
[STAThread]
static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Console.WriteLine("starting");
Store.Data = new StoreInstance();
if (args.Length > 0)
{
int processId = -1;
if(int.TryParse(args[0], out processId))
{
Store.Data.App.ParentProcessId = processId;
}
else
{
Loggers.CliLogger.Error("No parent process ID argument detected.");
}
}
ParentHeartbeatService.Monitor();
PipeService.Listen();
}
public static void Terminate()
{
MagnitudeService.Teardown();
PipeService.Teardown();
ParentHeartbeatService.Teardown();
Environment.Exit(0);
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var exception = (Exception)e.ExceptionObject;
ExceptionService.HandleException(exception, "AppDomain");
}
}
}