-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathProgram.cs
55 lines (48 loc) · 2.19 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
//NCShark - By AlSch092 @ Github, thanks to @Diamondo25 for MapleShark
using Microsoft.Win32;
using ScriptNET.Runtime;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Forms;
using System.Security.Principal;
using SharpPcap.LibPcap;
namespace NCShark
{
internal static class Program
{
[STAThread]
private static void Main(string[] pArgs)
{
try
{
if (LibPcapLiveDeviceList.Instance.Count == 0) throw new Exception();
}
catch
{
if (MessageBox.Show(null, "Did you install WinPcap first? If you did, then try to run NCShark in Administrator Mode, else press 'No' to go to the install page of WinPcap.", "Interface Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == System.Windows.Forms.DialogResult.No)
{
System.Diagnostics.Process.Start("http://www.winpcap.org/install/default.htm");
}
Environment.Exit(2);
return;
}
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += (sender, args) =>
{
Exception e = (Exception)args.ExceptionObject;
System.IO.File.WriteAllText("NCShark Error.txt", e.ToString());
if (MessageBox.Show("Exception occurred. Open error in notepad?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
System.Diagnostics.Process.Start("notepad", "\"NCShark Error.txt\"");
}
};
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (new frmSplash().ShowDialog() == DialogResult.OK)
Application.Run(new MainForm(pArgs));
}
internal static string AssemblyVersion { get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } }
internal static string AssemblyCopyright { get { return ((AssemblyCopyrightAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0]).Copyright; } }
}
}