-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
58 lines (44 loc) · 1.84 KB
/
Copy pathProgram.cs
File metadata and controls
58 lines (44 loc) · 1.84 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.Diagnostics;
using System.Windows.Forms;
using Utils;
using Utils.VisualStudio;
namespace ChromeDebugger
{
public class Program
{
private static StandardStreamService streamService;
private static string logPath;
private static string workingDirectory;
private static LogWriter logWriter;
public static void Main(string[] args)
{
var parentProcess = Process.GetCurrentProcess().GetParent();
var currentDirectory = Environment.CurrentDirectory;
if (args.Length < 1)
{
Console.WriteLine("Missing working directory argument.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Console.WriteLine("Usage: ChromeDebugger.exe <working_directory>");
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
return;
}
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
try
{
workingDirectory = args[0];
logPath = Path.Combine(args[0], @".vscode\logs\" + DateTime.Now.ToSortableShortDateTimeText() + "_VSCodeDebugger.log");
logWriter = new LogWriter(logPath);
VisualStudioExtensions.DebugAttach(false, true);
streamService = new StandardStreamService(logWriter, workingDirectory);
streamService.Start(parentProcess, currentDirectory);
Console.Error.WriteLine("About to enter streamService.Wait().");
streamService.Wait();
Console.Error.WriteLine("streamService.Wait() returned.");
}
catch (Exception ex)
{
Console.Error.WriteLine("Exception: " + ex.ToString());
}
}
}
}