示例#1
0
        private void cmbDevices_SelectedIndexChanged(object sender, EventArgs ea)
        {
            labTargetMetric.Text = MetricFixer.CreateFixJobs(((NetworkAdapter)cmbDevices.SelectedItem).InterfaceNumber, _fixJobs).ToString();

            labRoutesToFix.Text = _fixJobs.Count.ToString();
            labMaxMetric.Text   = "?";
        }
示例#2
0
        private void bFixit_Click(object sender, EventArgs e)
        {
            if (_fixJobs.Count == 0)
            {
                MessageBox.Show(this, "Die Metriken scheinen so korrekt zu sein, um über " + cmbDevices.SelectedItem.ToString() + " zu spielen.\r\nKeine Metrik-Änderungen sind notwendig.", "Hamachi Metric Fixer", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            bFixit.Enabled = false;
            if (!(cmbDevices.SelectedItem is NetworkAdapter))
            {
                MessageBox.Show(this, "Erst Netzwerkkarte zum spielen auswählen!", "Hamachi Metric Fixer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            Action fix = new Action(() =>
            {
                if (IsAdmin())
                {
                    MetricFixer.ExecuteJobs(_fixJobs);
                }
                else
                {
                    StartElevated("-execute " + CreateStringOfJobList(_fixJobs));
                }
            });

            fix.BeginInvoke(new AsyncCallback(FixComplete), null);
        }
示例#3
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainForm form = new MainForm();

            if (args.Length > 0 && args[0] == "-execute")
            {
                if (!MainForm.IsAdmin())
                {
                    MessageBox.Show("Operation ohne Administratorrechten nicht möglich.");
                }
                else
                {
                    string[] jobs = new string[args.Length - 1];
                    Array.Copy(args, 1, jobs, 0, args.Length - 1);
                    MetricFixer.ExecuteJobs(MainForm.CreateListOfStringJobs(jobs));
                    return;
                }
            }
            Application.Run(form);
        }