Exemplo n.º 1
0
        internal FiddlerAppContext(ILogger logger)
        {
            _logger = logger;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ApplicationExit += OnApplicationExit;

            FiddlerOptions.SetLogger(_logger);
            FiddlerOptions.Startup();

            _logger.Information("Starting loading profile form...");
            var profile = new LoadProfile {
                TopMost = true
            };
            var profileResult = profile.ShowDialog();

            if (profileResult == DialogResult.Cancel)
            {
                _logger.Information("No profile loaded... exiting.");
                return;
            }

            if (FiddlerOptions.UpdateCheckOnStart)
            {
                _logger.Information("Update check. Current version is {currentVersion}", FiddlerOptions.AppVersion);
                UpdateRunner.RunAsync(FiddlerOptions.RepositoryOwner, FiddlerOptions.RepositoryName, FiddlerOptions.AppVersion, false).GetAwaiter().GetResult();
            }

            _logger.Information("Starting main form...");
            MainForm = new MainForm();
            MainForm.Show();
        }
Exemplo n.º 2
0
        private void LoadSelectedProfile()
        {
            if (comboBoxLoad.SelectedIndex == -1)
            {
                return;
            }

            Options.ProfileName = $"{_profiles[comboBoxLoad.SelectedIndex]}.xml";
            FiddlerOptions.Logger.Information("Loading profile: {profileName}", Options.ProfileName);
            FiddlerOptions.LoadProfile($"{_profiles[comboBoxLoad.SelectedIndex]}.xml");

            Close();
        }
Exemplo n.º 3
0
        private void OnClickCreate(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBoxCreate.Text))
            {
                MessageBox.Show("Profile name is missing", "New Profile", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Options.ProfileName = $"Options_{textBoxCreate.Text}.xml";
            FiddlerOptions.Logger.Information("Creating profile: {profileName}", Options.ProfileName);
            FiddlerOptions.LoadProfile($"{_profiles[comboBoxBasedOn.SelectedIndex]}.xml");

            Close();
        }
Exemplo n.º 4
0
 private static void Main()
 {
     try
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         FiddlerOptions.Startup();
         Application.Run(new Forms.UoFiddler());
         FiddlerOptions.Save();
         Map.SaveMapOverlays();
     }
     catch (Exception err)
     {
         Clipboard.SetDataObject(err.ToString(), true);
         Application.Run(new ExceptionForm(err));
     }
 }
Exemplo n.º 5
0
 private void OnClickUpdate(object sender, EventArgs e)
 {
     progresslabel.Text    = "Checking...";
     progresslabel.Visible = true;
     string[] match = FiddlerOptions.CheckForUpdate(out string error);
     if (match == null)
     {
         MessageBox.Show($"Error:\n{error}", "Check for Update", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         progresslabel.Text = "";
     }
     else if (match.Length == 2)
     {
         if (UoFiddler.Version.Equals(match[0]))
         {
             MessageBox.Show("Your Version is up-to-date", "Check for Update");
             progresslabel.Text = "";
         }
         else if (FiddlerOptions.VersionCheck(match[0]))
         {
             DialogResult result =
                 MessageBox.Show(
                     $"{string.Format("A new version was found: {1} your version: {0}", UoFiddler.Version, match[0])}\nDownload now?", "Check for Update", MessageBoxButtons.YesNo);
             if (result == DialogResult.Yes)
             {
                 DownloadFile(match[1]);
             }
         }
         else
         {
             DialogResult result = MessageBox.Show($"Your version differs: {UoFiddler.Version} Found: {match[0]}\nDownload now?", "Check for Update", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
             if (result == DialogResult.Yes)
             {
                 DownloadFile(match[1]);
             }
             else
             {
                 progresslabel.Text = "";
             }
         }
     }
     else
     {
         MessageBox.Show("Failed to get version info", "Check for Update", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
         progresslabel.Text = "";
     }
 }
Exemplo n.º 6
0
 private void OnApplicationExit(object sender, EventArgs e)
 {
     FiddlerOptions.SaveProfile();
     Map.SaveMapOverlays();
     _logger.Information("UOFiddler - Application exit.");
 }