Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions UoFiddler.Controls/UserControls/HuesControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,32 @@ private void HueIndexToolStripTextBox_KeyUp(object sender, KeyEventArgs e)
vScrollBar.Value = scrollPosition;
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.F))
{
HueNameToolStripTextBox.Focus();
HueNameToolStripTextBox.SelectAll();
return true;
}

if (keyData == (Keys.Control | Keys.G))
{
HueIndexToolStripTextBox.Focus();
HueIndexToolStripTextBox.SelectAll();
return true;
}

if (keyData == Keys.F3 && !HueNameToolStripTextBox.TextBox.Focused &&
!string.IsNullOrEmpty(HueNameToolStripTextBox.Text))
{
FindByName(Selected);
return true;
}

return base.ProcessCmdKey(ref msg, keyData);
}

private void SearchNameToolStripButton_Click(object sender, EventArgs e)
{
FindByName(Selected);
Expand Down
14 changes: 14 additions & 0 deletions UoFiddler.Controls/UserControls/ItemsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,20 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
return true;
}

if (keyData == (Keys.Control | Keys.F))
{
searchByNameToolStripTextBox.Focus();
searchByNameToolStripTextBox.SelectAll();
return true;
}

if (keyData == (Keys.Control | Keys.G))
{
searchByIdToolStripTextBox.Focus();
searchByIdToolStripTextBox.SelectAll();
return true;
}

if (keyData == Keys.F3 || keyData == (Keys.F3 | Keys.Shift))
{
if (searchByNameToolStripTextBox.TextBox.Focused)
Expand Down
14 changes: 14 additions & 0 deletions UoFiddler.Controls/UserControls/LandTilesControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,20 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
return true;
}

if (keyData == (Keys.Control | Keys.F))
{
searchByNameToolStripTextBox.Focus();
searchByNameToolStripTextBox.SelectAll();
return true;
}

if (keyData == (Keys.Control | Keys.G))
{
searchByIdToolStripTextBox.Focus();
searchByIdToolStripTextBox.SelectAll();
return true;
}

if (keyData == Keys.F3 || keyData == (Keys.F3 | Keys.Shift))
{
if (searchByNameToolStripTextBox.TextBox.Focused)
Expand Down
7 changes: 7 additions & 0 deletions UoFiddler.Controls/UserControls/TexturesControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,13 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
return true;
}

if (keyData == (Keys.Control | Keys.F) || keyData == (Keys.Control | Keys.G))
{
searchByIdToolStripTextBox.Focus();
searchByIdToolStripTextBox.SelectAll();
return true;
}

return base.ProcessCmdKey(ref msg, keyData);
}

Expand Down
119 changes: 86 additions & 33 deletions UoFiddler/Forms/ExceptionForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 72 additions & 3 deletions UoFiddler/Forms/ExceptionForm.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
/***************************************************************************
*
* $Author: Turley
*
*
* "THE BEER-WARE LICENSE"
* As long as you retain this notice you can do whatever you want with
* As long as you retain this notice you can do whatever you want with
* this stuff. If we meet some day, and you think this stuff is worth it,
* you can buy me a beer in return.
*
***************************************************************************/

using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using UoFiddler.Classes;
using UoFiddler.Controls.Classes;

namespace UoFiddler.Forms
{
public partial class ExceptionForm : Form
{
private readonly Exception _error;

public ExceptionForm(Exception err)
{
InitializeComponent();
Icon = Options.GetFiddlerIcon();

_error = err;

richTextBox.Text = err.InnerException != null
? $"{err.InnerException.Message}\n{err.InnerException.GetType()}"
: string.Empty;
Expand All @@ -33,5 +41,66 @@ private void OnClick(object sender, EventArgs e)
{
Close();
}

private string ReportText => $"UOFiddler {FiddlerOptions.AppVersion}{Environment.NewLine}{_error}";

private bool TryCopyReport()
{
try
{
Clipboard.SetText(ReportText);
return true;
}
catch (ExternalException)
{
// The clipboard can be held by another process; copying is a convenience only.
return false;
}
}

private void OnClickCopy(object sender, EventArgs e)
{
CopyButton.Text = TryCopyReport() ? "Copied" : "Copy failed";
}

private void OnClickOpenLogFolder(object sender, EventArgs e)
{
string logFolder = Path.Combine(Options.AppDataPath, "log");

try
{
Directory.CreateDirectory(logFolder);
Process.Start(new ProcessStartInfo { FileName = logFolder, UseShellExecute = true });
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or System.ComponentModel.Win32Exception)
{
MessageBox.Show(this, ex.Message, "Open Log Folder", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}

/// <summary>
/// Opens a new GitHub issue titled after the error. The full details go to the clipboard to be
/// pasted in, since a stack trace easily exceeds what a URL can carry.
/// </summary>
private void OnClickReport(object sender, EventArgs e)
{
bool copied = TryCopyReport();

string title = Uri.EscapeDataString($"Crash: {_error.GetType().Name}: {_error.Message}");
string body = Uri.EscapeDataString(
"**Steps to reproduce:**\n\n\n**Exception details:**\n" +
(copied ? "(paste from clipboard)\n" : "(use Copy Details in the error window)\n"));

string url = $"https://github.com/{FiddlerOptions.RepositoryOwner}/{FiddlerOptions.RepositoryName}/issues/new?title={title}&body={body}";

try
{
Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true });
}
catch (System.ComponentModel.Win32Exception ex)
{
MessageBox.Show(this, ex.Message, "Report on GitHub", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}
}
6 changes: 6 additions & 0 deletions UoFiddler/Forms/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading