Пример #1
0
        static void Main()
        {
            runtime = true;
            CurrentProject = new Project.Project();
            if (CheckArgsToElevate())
                return;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            System.Threading.Thread tSplash = new System.Threading.Thread(new System.Threading.ThreadStart(delegate
                {
                    fSplash = new FormSplash();
                    Application.Run(fSplash);
                }));
            tSplash.Start();

            if (!(IsWinPcapIsInstalled()))
            {
                tSplash.Abort();
                MessageBox.Show("WinPcap library not found or no compatible device found. This is a mandatory requirement.\r\n\r\n\r\nPlease, download and install it from http://www.winpcap.org/.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Application.Exit();
                return;
            }

            int defaultInterface = Program.CurrentProject.data.settings.Interface;
            //La primera vez se muestra, el resto no

            WinPcapDevice dev = null;
            if (defaultInterface > -1 && defaultInterface < CaptureDeviceList.Instance.Count)
            {
                dev = (WinPcapDevice)CaptureDeviceList.Instance[defaultInterface];
            }

            while (dev == null || Program.CurrentProject.data.GetIPv6LocalLinkFromDevice(dev) == null)
            {
                if (dev != null)
                    MessageBox.Show("IP Address Local-Link hasn't been found. Please, turn on IPv6 on your network interface and restart the application or select other interface", "IP Address Local-Link hasn't been found",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                FormInterfaces fInterfaces = new FormInterfaces(true, true);
                if (fInterfaces.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    tSplash.Abort();
                    Application.Exit();
                    return;
                }

                dev = fInterfaces.device;
            }
            Program.CurrentProject.data.SetDevice(dev);

            Program.UriDotBug();

            formMain = new FormMain();

            Application.Run(formMain);
        }
Пример #2
0
        static void Main()
        {
            runtime        = true;
            CurrentProject = new Project.Project();
            if (CheckArgsToElevate())
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            System.Threading.Thread tSplash = new System.Threading.Thread(new System.Threading.ThreadStart(delegate
            {
                fSplash = new FormSplash();
                Application.Run(fSplash);
            }));
            tSplash.Start();

            if (!(IsWinPcapIsInstalled()))
            {
                tSplash.Abort();
                MessageBox.Show("WinPcap library not found or no compatible device found. This is a mandatory requirement.\r\n\r\n\r\nPlease, download and install it from http://www.winpcap.org/.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Application.Exit();
                return;
            }

            int defaultInterface = Program.CurrentProject.data.settings.Interface;
            //La primera vez se muestra, el resto no

            WinPcapDevice dev = null;

            if (defaultInterface > -1 && defaultInterface < CaptureDeviceList.Instance.Count)
            {
                dev = (WinPcapDevice)CaptureDeviceList.Instance[defaultInterface];
            }

            while (dev == null || Program.CurrentProject.data.GetIPv6LocalLinkFromDevice(dev) == null)
            {
                if (dev != null)
                {
                    MessageBox.Show("IP Address Local-Link hasn't been found. Please, turn on IPv6 on your network interface and restart the application or select other interface", "IP Address Local-Link hasn't been found",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                FormInterfaces fInterfaces = new FormInterfaces(true, true);
                if (fInterfaces.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    tSplash.Abort();
                    Application.Exit();
                    return;
                }

                dev = fInterfaces.device;
            }
            Program.CurrentProject.data.SetDevice(dev);

            Program.UriDotBug();

            formMain = new FormMain();

            Application.Run(formMain);
        }