From 09222e2cf4c97afef3478f6c6fcfb300e153338e Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Sun, 21 Aug 2016 20:05:41 -0500 Subject: [PATCH 01/17] Added form to provide a slightly more user-friendly error experience --- PKHeX/MainWindow/Main.cs | 15 +- PKHeX/Misc/ErrorWindow.Designer.cs | 129 +++++++++++++++++ PKHeX/Misc/ErrorWindow.cs | 104 ++++++++++++++ PKHeX/Misc/ErrorWindow.resx | 216 ++++++++++++++++++++++++++++ PKHeX/PKHeX.csproj | 11 ++ PKHeX/Program.cs | 66 ++++++++- PKHeX/Resources/text/en/lang_en.txt | 8 ++ PKHeX/Saves/SaveUtil.cs | 2 + 8 files changed, 548 insertions(+), 3 deletions(-) create mode 100644 PKHeX/Misc/ErrorWindow.Designer.cs create mode 100644 PKHeX/Misc/ErrorWindow.cs create mode 100644 PKHeX/Misc/ErrorWindow.resx diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index 4071e375d..48dd109df 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -1,4 +1,5 @@ -using System; +using PKHeX.Misc; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; @@ -117,7 +118,17 @@ public Main() } if (!SAV.Exportable) // No SAV loaded from exe args { - string path = SaveUtil.detectSaveFile(); + string path = null; + try + { + path = SaveUtil.detectSaveFile(); + } + catch (Exception ex) + { + // Todo: translate this + ErrorWindow.ShowErrorDialog("An error occurred while attempting to auto-load your save file.", ex, true); + } + if (path != null && File.Exists(path)) openQuick(path, force: true); else diff --git a/PKHeX/Misc/ErrorWindow.Designer.cs b/PKHeX/Misc/ErrorWindow.Designer.cs new file mode 100644 index 000000000..6304ffb77 --- /dev/null +++ b/PKHeX/Misc/ErrorWindow.Designer.cs @@ -0,0 +1,129 @@ +namespace PKHeX.Misc +{ + partial class ErrorWindow + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ErrorWindow)); + this.T_ExceptionDetails = new System.Windows.Forms.TextBox(); + this.L_Message = new System.Windows.Forms.Label(); + this.L_ProvideInfo = new System.Windows.Forms.Label(); + this.B_CopyToClipboard = new System.Windows.Forms.Button(); + this.B_Abort = new System.Windows.Forms.Button(); + this.B_Continue = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // T_ExceptionDetails + // + this.T_ExceptionDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.T_ExceptionDetails.Location = new System.Drawing.Point(12, 52); + this.T_ExceptionDetails.Multiline = true; + this.T_ExceptionDetails.Name = "T_ExceptionDetails"; + this.T_ExceptionDetails.ReadOnly = true; + this.T_ExceptionDetails.Size = new System.Drawing.Size(474, 143); + this.T_ExceptionDetails.TabIndex = 0; + // + // L_Message + // + this.L_Message.Location = new System.Drawing.Point(9, 9); + this.L_Message.Name = "L_Message"; + this.L_Message.Size = new System.Drawing.Size(363, 27); + this.L_Message.TabIndex = 1; + this.L_Message.Text = "An unknown error has occurred."; + // + // L_ProvideInfo + // + this.L_ProvideInfo.AutoSize = true; + this.L_ProvideInfo.Location = new System.Drawing.Point(9, 36); + this.L_ProvideInfo.Name = "L_ProvideInfo"; + this.L_ProvideInfo.Size = new System.Drawing.Size(269, 13); + this.L_ProvideInfo.TabIndex = 2; + this.L_ProvideInfo.Text = "Please provide this information when reporting this error:"; + // + // B_CopyToClipboard + // + this.B_CopyToClipboard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.B_CopyToClipboard.Location = new System.Drawing.Point(12, 201); + this.B_CopyToClipboard.Name = "B_CopyToClipboard"; + this.B_CopyToClipboard.Size = new System.Drawing.Size(133, 23); + this.B_CopyToClipboard.TabIndex = 3; + this.B_CopyToClipboard.Text = "Copy to Clipboard"; + this.B_CopyToClipboard.UseVisualStyleBackColor = true; + this.B_CopyToClipboard.Click += new System.EventHandler(this.btnCopyToClipboard_Click); + // + // B_Abort + // + this.B_Abort.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.B_Abort.Location = new System.Drawing.Point(411, 201); + this.B_Abort.Name = "B_Abort"; + this.B_Abort.Size = new System.Drawing.Size(75, 23); + this.B_Abort.TabIndex = 4; + this.B_Abort.Text = "Abort"; + this.B_Abort.UseVisualStyleBackColor = true; + this.B_Abort.Click += new System.EventHandler(this.B_Abort_Click); + // + // B_Continue + // + this.B_Continue.Location = new System.Drawing.Point(330, 201); + this.B_Continue.Name = "B_Continue"; + this.B_Continue.Size = new System.Drawing.Size(75, 23); + this.B_Continue.TabIndex = 5; + this.B_Continue.Text = "Continue"; + this.B_Continue.UseVisualStyleBackColor = true; + this.B_Continue.Click += new System.EventHandler(this.B_Continue_Click); + // + // ErrorWindow + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(498, 236); + this.Controls.Add(this.B_Continue); + this.Controls.Add(this.B_Abort); + this.Controls.Add(this.B_CopyToClipboard); + this.Controls.Add(this.L_ProvideInfo); + this.Controls.Add(this.L_Message); + this.Controls.Add(this.T_ExceptionDetails); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "ErrorWindow"; + this.Text = "Error"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox T_ExceptionDetails; + private System.Windows.Forms.Label L_Message; + private System.Windows.Forms.Label L_ProvideInfo; + private System.Windows.Forms.Button B_CopyToClipboard; + private System.Windows.Forms.Button B_Abort; + private System.Windows.Forms.Button B_Continue; + } +} \ No newline at end of file diff --git a/PKHeX/Misc/ErrorWindow.cs b/PKHeX/Misc/ErrorWindow.cs new file mode 100644 index 000000000..d070c1659 --- /dev/null +++ b/PKHeX/Misc/ErrorWindow.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace PKHeX.Misc +{ + public partial class ErrorWindow : Form + { + public static void ShowErrorDialog(string friendlyMessage, Exception ex, bool allowContinue) + { + var dialog = new ErrorWindow(); // Todo: provide language + dialog.ShowContinue = allowContinue; + dialog.Message = friendlyMessage; + dialog.Error = ex; + + var dialogResult = dialog.ShowDialog(); + if (dialogResult == DialogResult.Abort) + { + Application.Exit(); + } + } + + public ErrorWindow() + { + InitializeComponent(); + } + + public ErrorWindow(string lang) : this() + { + Util.TranslateInterface(this, lang); + } + + /// + /// Gets or sets whether or not the "Continue" button is visible. + /// + /// For UI exceptions, continuing could be safe. + /// For application exceptions, continuing is not possible, so the button should not be shown. + public bool ShowContinue + { + get + { + return B_Continue.Visible; + } + set + { + B_Continue.Visible = value; + } + } + + /// + /// Friendly, context-specific method shown to the user. + /// + /// This property is intended to be a user-friendly context-specific message about what went wrong. + /// For example: "An error occurred while attempting to automatically load the save file." + public string Message + { + get + { + return L_Message.Text; + } + set + { + L_Message.Text = value; + } + } + + public Exception Error + { + get + { + return _error; + } + set + { + _error = value; + T_ExceptionDetails.Text = value.ToString(); + } + } + private Exception _error; + + private void btnCopyToClipboard_Click(object sender, EventArgs e) + { + Clipboard.SetText(T_ExceptionDetails.Text); + } + + private void B_Continue_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.OK; + Close(); + } + + private void B_Abort_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Abort; + Close(); + } + + } +} diff --git a/PKHeX/Misc/ErrorWindow.resx b/PKHeX/Misc/ErrorWindow.resx new file mode 100644 index 000000000..603f660be --- /dev/null +++ b/PKHeX/Misc/ErrorWindow.resx @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAE + AAAAAAAAAAAAAAAAAAAAAAAAIyMjAQAAAAALCwsPJiYmJysrKycqKionKSkpJykpKScpKSknKioqJyoq + KicrKysnJycnJw0ODQ8AAAAAJiYmAQAAAABpaWlHq6ur17+/v+6+vr7svr6+7b6+vu2+vr7tvr6+7b6+ + vu2+vr7tvr6+7L+/v+6rq6vXampqSAAAAAAoKSgXvr++3eLi4v/g4OD94eHh/+Hh4f/i4uL/4uLi/+Li + 4v/i4uL/4eHh/+Dh4P/g4OD94uLi/7+/v90sLCwXfn5+PNna2frg4OD/39/f/uHh4f7h4eH+39/f/uDg + 4P7g4OD+39/f/uHh4f7h4OH+39/f/t/g3//a2tr6g4ODPoOCgz7X19f64+Pj/+Li4v7k5OT/4+Tj//Ly + 8v/19fX/9PT0//T09P/k5OT/5OTk/+Pj4/7j4+P/19jX+4qLikCDhIM+2tra++Xl5f/k5eT+5OTk//Lz + 8v+urq7/RUVF/z4+Pv+Zmpn/8fHx/+Xm5f/k5eT+5eXl/9ra2vyLi4tAhYWFPuXm5vvx8vP/7+/w/v// + //+sra3/AgIC/15eXv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CynyCwsp8gsLKfILCynyCws + p8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyDExqcU2NpenLi54Shsb + ewMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////8AAAD+AAAAfAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AAPAAAADwAAAA8AAAAPAAAAD4AAAB/gAAB////// + + + \ No newline at end of file diff --git a/PKHeX/PKHeX.csproj b/PKHeX/PKHeX.csproj index a0a1c2b8b..d29e0afc9 100644 --- a/PKHeX/PKHeX.csproj +++ b/PKHeX/PKHeX.csproj @@ -61,9 +61,11 @@ + + @@ -85,6 +87,12 @@ Form + + Form + + + ErrorWindow.cs + @@ -302,6 +310,9 @@ + + ErrorWindow.cs + QR.cs Designer diff --git a/PKHeX/Program.cs b/PKHeX/Program.cs index ac985bb52..beec37eb6 100644 --- a/PKHeX/Program.cs +++ b/PKHeX/Program.cs @@ -1,4 +1,7 @@ -using System; +using PKHeX.Misc; +using System; +using System.Diagnostics; +using System.Threading; using System.Windows.Forms; namespace PKHeX @@ -11,9 +14,70 @@ internal static class Program [STAThread] private static void Main() { + // Add the event handler for handling UI thread exceptions to the event. + Application.ThreadException += new ThreadExceptionEventHandler(UIThreadException); + + // Set the unhandled exception mode to force all Windows Forms errors to go through our handler. + Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); + + // Add the event handler for handling non-UI thread exceptions to the event. + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); + + // Run the application Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Main()); } + + // Handle the UI exceptions by showing a dialog box, and asking the user whether or not they wish to abort execution. + private static void UIThreadException(object sender, ThreadExceptionEventArgs t) + { + DialogResult result = DialogResult.Cancel; + try + { + ErrorWindow.ShowErrorDialog("An unhandled exception has occurred.\nYou can continue running PKHeX, but please report this error.", t.Exception, true); + } + catch + { + try + { + // Todo: make this translatable + MessageBox.Show("A fatal error has occurred in PKHeX, and the details could not be displayed. Please report this to the author.", "PKHeX Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + finally + { + Application.Exit(); + } + } + + // Exits the program when the user clicks Abort. + if (result == DialogResult.Abort) + Application.Exit(); + } + + // Handle the UI exceptions by showing a dialog box, and asking the user whether + // or not they wish to abort execution. + // NOTE: This exception cannot be kept from terminating the application - it can only + // log the event, and inform the user about it. + private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + try + { + var ex = (Exception)e.ExceptionObject; + ErrorWindow.ShowErrorDialog("An unhandled exception has occurred.\nPKHeX must now close.", ex, false); + } + catch + { + try + { + // Todo: make this translatable + MessageBox.Show("A fatal non-UI error has occurred in PKHeX, and the details could not be displayed. Please report this to the author.", "PKHeX Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); + } + finally + { + Application.Exit(); + } + } + } } } diff --git a/PKHeX/Resources/text/en/lang_en.txt b/PKHeX/Resources/text/en/lang_en.txt index 67fe2dc47..602ad5bfe 100644 --- a/PKHeX/Resources/text/en/lang_en.txt +++ b/PKHeX/Resources/text/en/lang_en.txt @@ -797,4 +797,12 @@ B_Import = Import B_Output = Export B_Cancel = Cancel B_Save = Save +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! ErrorWindow = Error +- Change stuff below this line, not above. +------------------------------------------------------- +L_ProvideInfo = Please provide this information when reporting this error: +B_CopyToClipboard = Copy to Clipboard ! End \ No newline at end of file diff --git a/PKHeX/Saves/SaveUtil.cs b/PKHeX/Saves/SaveUtil.cs index 9ad69d911..68cea727a 100644 --- a/PKHeX/Saves/SaveUtil.cs +++ b/PKHeX/Saves/SaveUtil.cs @@ -184,6 +184,8 @@ public static SaveFile getVariantSAV(byte[] data) /// Full path of a save file. Returns null if unable to find any. public static string detectSaveFile() { + + throw new Exception("Testing..."); string path; string path3DS = Path.GetPathRoot(Util.get3DSLocation()); List possiblePaths = new List(); From 56a32ec68c7db9523ae28c4596b2c86243e9a0d6 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Sun, 21 Aug 2016 20:12:09 -0500 Subject: [PATCH 02/17] Changing language changes thread culture... ...which is used by the ErrorWindow for translation --- PKHeX/MainWindow/Main.cs | 5 +++++ PKHeX/Misc/ErrorWindow.cs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index 48dd109df..83e74d64c 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Drawing; +using System.Globalization; using System.IO; using System.Linq; using System.Media; @@ -944,6 +945,10 @@ private void changeMainLanguage(object sender, EventArgs e) FLP_PKMEditors.Location = new Point((tabMain.TabPages[4].Width - FLP_PKMEditors.Width)/2, FLP_PKMEditors.Location.Y); populateFields(pk); // put data back in form fieldsInitialized |= alreadyInit; + + // Set the culture (makes it easy to pass language to other forms) + Thread.CurrentThread.CurrentCulture = new CultureInfo(lang_val[CB_MainLanguage.SelectedIndex]); + Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; } private void InitializeStrings() { diff --git a/PKHeX/Misc/ErrorWindow.cs b/PKHeX/Misc/ErrorWindow.cs index d070c1659..7fa0ef488 100644 --- a/PKHeX/Misc/ErrorWindow.cs +++ b/PKHeX/Misc/ErrorWindow.cs @@ -13,7 +13,8 @@ public partial class ErrorWindow : Form { public static void ShowErrorDialog(string friendlyMessage, Exception ex, bool allowContinue) { - var dialog = new ErrorWindow(); // Todo: provide language + var lang = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName; + var dialog = new ErrorWindow(lang); dialog.ShowContinue = allowContinue; dialog.Message = friendlyMessage; dialog.Error = ex; From f734f382f4e63aa304d6a9648857ad8ed3139792 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Sun, 21 Aug 2016 20:20:09 -0500 Subject: [PATCH 03/17] Added English for Error Window to other languages --- PKHeX/Resources/text/de/lang_de.txt | 10 ++++++++++ PKHeX/Resources/text/en/lang_en.txt | 2 ++ PKHeX/Resources/text/es/lang_es.txt | 10 ++++++++++ PKHeX/Resources/text/it/lang_it.txt | 10 ++++++++++ PKHeX/Resources/text/ja/lang_ja.txt | 10 ++++++++++ PKHeX/Resources/text/ko/lang_ko.txt | 10 ++++++++++ PKHeX/Resources/text/zh/lang_zh.txt | 10 ++++++++++ 7 files changed, 62 insertions(+) diff --git a/PKHeX/Resources/text/de/lang_de.txt b/PKHeX/Resources/text/de/lang_de.txt index 407439b28..79164bf42 100644 --- a/PKHeX/Resources/text/de/lang_de.txt +++ b/PKHeX/Resources/text/de/lang_de.txt @@ -344,4 +344,14 @@ Tab_Residence = Herkunft - **Please leave the {0} in your line. The OT name will show instead. -- L_Arguments = Deaktiviert ; Nie verlassen ; OT ; Letzte Gen. ; Erinnerungen mit ; Pokémon ; Area ; Item(s) ; Move ; Location +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! ErrorWindow = Error +- Change stuff below this line, not above. +------------------------------------------------------- +L_ProvideInfo = Please provide this information when reporting this error: +B_CopyToClipboard = Copy to Clipboard +B_Continue = Continue +B_Abort = Abort ! End \ No newline at end of file diff --git a/PKHeX/Resources/text/en/lang_en.txt b/PKHeX/Resources/text/en/lang_en.txt index 602ad5bfe..8b4909415 100644 --- a/PKHeX/Resources/text/en/lang_en.txt +++ b/PKHeX/Resources/text/en/lang_en.txt @@ -805,4 +805,6 @@ B_Save = Save ------------------------------------------------------- L_ProvideInfo = Please provide this information when reporting this error: B_CopyToClipboard = Copy to Clipboard +B_Continue = Continue +B_Abort = Abort ! End \ No newline at end of file diff --git a/PKHeX/Resources/text/es/lang_es.txt b/PKHeX/Resources/text/es/lang_es.txt index 916db7d46..6003d1ee1 100644 --- a/PKHeX/Resources/text/es/lang_es.txt +++ b/PKHeX/Resources/text/es/lang_es.txt @@ -799,3 +799,13 @@ B_Output = Exportar B_Cancel = Cancelar B_Save = Guardar ! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! ErrorWindow = Error +- Change stuff below this line, not above. +------------------------------------------------------- +L_ProvideInfo = Please provide this information when reporting this error: +B_CopyToClipboard = Copy to Clipboard +B_Continue = Continue +B_Abort = Abort +! End \ No newline at end of file diff --git a/PKHeX/Resources/text/it/lang_it.txt b/PKHeX/Resources/text/it/lang_it.txt index e3c1ccb30..4d420ff40 100644 --- a/PKHeX/Resources/text/it/lang_it.txt +++ b/PKHeX/Resources/text/it/lang_it.txt @@ -797,4 +797,14 @@ B_Import = Import B_Output = Export B_Cancel = Cancel B_Save = Save +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! ErrorWindow = Error +- Change stuff below this line, not above. +------------------------------------------------------- +L_ProvideInfo = Please provide this information when reporting this error: +B_CopyToClipboard = Copy to Clipboard +B_Continue = Continue +B_Abort = Abort ! End \ No newline at end of file diff --git a/PKHeX/Resources/text/ja/lang_ja.txt b/PKHeX/Resources/text/ja/lang_ja.txt index 5aebea89f..088797469 100644 --- a/PKHeX/Resources/text/ja/lang_ja.txt +++ b/PKHeX/Resources/text/ja/lang_ja.txt @@ -359,4 +359,14 @@ L_Region = 地域 L_Country = 国 -- L_Arguments = 使用禁止 ; 左はありませんでした ; OT ; 前回のゲーム ; との思い出 ; ポケモン ; エリア ; 項目 ; わざ ; 場所 ; +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! ErrorWindow = Error +- Change stuff below this line, not above. +------------------------------------------------------- +L_ProvideInfo = Please provide this information when reporting this error: +B_CopyToClipboard = Copy to Clipboard +B_Continue = Continue +B_Abort = Abort ! End \ No newline at end of file diff --git a/PKHeX/Resources/text/ko/lang_ko.txt b/PKHeX/Resources/text/ko/lang_ko.txt index c66077b15..dff836197 100644 --- a/PKHeX/Resources/text/ko/lang_ko.txt +++ b/PKHeX/Resources/text/ko/lang_ko.txt @@ -797,4 +797,14 @@ B_Import = 넣기 B_Output = 빼내기 B_Cancel = 취소 B_Save = 저장 +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! ErrorWindow = Error +- Change stuff below this line, not above. +------------------------------------------------------- +L_ProvideInfo = Please provide this information when reporting this error: +B_CopyToClipboard = Copy to Clipboard +B_Continue = Continue +B_Abort = Abort ! End \ No newline at end of file diff --git a/PKHeX/Resources/text/zh/lang_zh.txt b/PKHeX/Resources/text/zh/lang_zh.txt index 08fb9c463..e1c293ded 100644 --- a/PKHeX/Resources/text/zh/lang_zh.txt +++ b/PKHeX/Resources/text/zh/lang_zh.txt @@ -797,4 +797,14 @@ B_Import = 导入 B_Output = 导出 B_Cancel = 取消 B_Save = 保存 +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! ErrorWindow = Error +- Change stuff below this line, not above. +------------------------------------------------------- +L_ProvideInfo = Please provide this information when reporting this error: +B_CopyToClipboard = Copy to Clipboard +B_Continue = Continue +B_Abort = Abort ! End \ No newline at end of file From 563d8133078b4aeaf4ef52cf8da2e4f8ee567f59 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Sun, 21 Aug 2016 20:20:21 -0500 Subject: [PATCH 04/17] Added my attempt at a French translation for the Error Window --- PKHeX/Resources/text/fr/lang_fr.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PKHeX/Resources/text/fr/lang_fr.txt b/PKHeX/Resources/text/fr/lang_fr.txt index 4c5974a69..a7371ae4d 100644 --- a/PKHeX/Resources/text/fr/lang_fr.txt +++ b/PKHeX/Resources/text/fr/lang_fr.txt @@ -361,4 +361,14 @@ L_Country = Pays - **Please leave the {0} in your line. The OT name will show instead. -- L_Arguments = Onglet désactivé ; Toujours avec ; DO ; Génération précédente - ; Souvenirs avec ; Pokémon ; Zone ; Objet(s) ; Attaque ; Emplacement +! End +! ----------------------------------------------------- +- DO NOT CHANGE THIS SECTION. +! ErrorWindow = Erreur +- Change stuff below this line, not above. +------------------------------------------------------- +L_ProvideInfo = S'il vous plaît fournir ces informations lorsque vous rapportez cette error: +B_CopyToClipboard = Copier dans les Notes +B_Continue = Continuer +B_Abort = Abandonner ! End \ No newline at end of file From b0604b2fb3d0d37a433c10fa918a47303f79e9d1 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Sun, 21 Aug 2016 20:21:44 -0500 Subject: [PATCH 05/17] Removed test exception --- PKHeX/Saves/SaveUtil.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/PKHeX/Saves/SaveUtil.cs b/PKHeX/Saves/SaveUtil.cs index 68cea727a..9ad69d911 100644 --- a/PKHeX/Saves/SaveUtil.cs +++ b/PKHeX/Saves/SaveUtil.cs @@ -184,8 +184,6 @@ public static SaveFile getVariantSAV(byte[] data) /// Full path of a save file. Returns null if unable to find any. public static string detectSaveFile() { - - throw new Exception("Testing..."); string path; string path3DS = Path.GetPathRoot(Util.get3DSLocation()); List possiblePaths = new List(); From e6cbd35f05b3aa60c1daa23154d3477d29e94ea1 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Sun, 21 Aug 2016 20:23:32 -0500 Subject: [PATCH 06/17] Added Todo comments --- PKHeX/Program.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PKHeX/Program.cs b/PKHeX/Program.cs index beec37eb6..823d9e565 100644 --- a/PKHeX/Program.cs +++ b/PKHeX/Program.cs @@ -35,6 +35,7 @@ private static void UIThreadException(object sender, ThreadExceptionEventArgs t) DialogResult result = DialogResult.Cancel; try { + // Todo: make this translatable ErrorWindow.ShowErrorDialog("An unhandled exception has occurred.\nYou can continue running PKHeX, but please report this error.", t.Exception, true); } catch @@ -64,6 +65,7 @@ private static void CurrentDomain_UnhandledException(object sender, UnhandledExc try { var ex = (Exception)e.ExceptionObject; + // Todo: make this translatable ErrorWindow.ShowErrorDialog("An unhandled exception has occurred.\nPKHeX must now close.", ex, false); } catch From 55cb6ee2c0fdd6624c762641f04a03f88218ddba Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Mon, 22 Aug 2016 09:04:20 -0500 Subject: [PATCH 07/17] Added vacero's Spanish ErrorWindow translation --- PKHeX/Resources/text/es/lang_es.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PKHeX/Resources/text/es/lang_es.txt b/PKHeX/Resources/text/es/lang_es.txt index 6003d1ee1..2653bb3e0 100644 --- a/PKHeX/Resources/text/es/lang_es.txt +++ b/PKHeX/Resources/text/es/lang_es.txt @@ -804,8 +804,8 @@ B_Save = Guardar ! ErrorWindow = Error - Change stuff below this line, not above. ------------------------------------------------------- -L_ProvideInfo = Please provide this information when reporting this error: -B_CopyToClipboard = Copy to Clipboard -B_Continue = Continue -B_Abort = Abort +L_ProvideInfo = Por favor, proporciona esta información cuando reportes este fallo: +B_CopyToClipboard = Copiar al portapapeles +B_Continue = Continuar +B_Abort = Abortar ! End \ No newline at end of file From 6a0ba1e3b78533f15a47e3a3620d51f8353cb69d Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Mon, 22 Aug 2016 09:14:37 -0500 Subject: [PATCH 08/17] Added loaded assemblies to error window --- PKHeX/Misc/ErrorWindow.Designer.cs | 1 + PKHeX/Misc/ErrorWindow.cs | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/PKHeX/Misc/ErrorWindow.Designer.cs b/PKHeX/Misc/ErrorWindow.Designer.cs index 6304ffb77..e2a602d7d 100644 --- a/PKHeX/Misc/ErrorWindow.Designer.cs +++ b/PKHeX/Misc/ErrorWindow.Designer.cs @@ -46,6 +46,7 @@ private void InitializeComponent() this.T_ExceptionDetails.Multiline = true; this.T_ExceptionDetails.Name = "T_ExceptionDetails"; this.T_ExceptionDetails.ReadOnly = true; + this.T_ExceptionDetails.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.T_ExceptionDetails.Size = new System.Drawing.Size(474, 143); this.T_ExceptionDetails.TabIndex = 0; // diff --git a/PKHeX/Misc/ErrorWindow.cs b/PKHeX/Misc/ErrorWindow.cs index 7fa0ef488..2e59f25f0 100644 --- a/PKHeX/Misc/ErrorWindow.cs +++ b/PKHeX/Misc/ErrorWindow.cs @@ -79,7 +79,31 @@ public Exception Error set { _error = value; - T_ExceptionDetails.Text = value.ToString(); + + var details = new StringBuilder(); + details.AppendLine("Exception Details:"); + details.AppendLine(value.ToString()); + details.AppendLine(); + + details.AppendLine("Loaded Assemblies:"); + details.AppendLine("--------------------"); + try + { + foreach (var item in AppDomain.CurrentDomain.GetAssemblies()) + { + details.AppendLine(item.FullName); + details.AppendLine(item.Location); + details.AppendLine(); + } + } + catch (Exception ex) + { + details.AppendLine("An error occurred while listing the Loaded Assemblies:"); + details.AppendLine(ex.ToString()); + } + details.AppendLine("--------------------"); + + T_ExceptionDetails.Text = details.ToString(); } } private Exception _error; From a9712eecc60f0feb134240818dbf92587b4a4776 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Mon, 22 Aug 2016 09:20:19 -0500 Subject: [PATCH 09/17] Added TheSonAlsoRises's updated French translation --- PKHeX/Misc/ErrorWindow.Designer.cs | 2 +- PKHeX/Resources/text/fr/lang_fr.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/PKHeX/Misc/ErrorWindow.Designer.cs b/PKHeX/Misc/ErrorWindow.Designer.cs index e2a602d7d..b7ed1f513 100644 --- a/PKHeX/Misc/ErrorWindow.Designer.cs +++ b/PKHeX/Misc/ErrorWindow.Designer.cs @@ -72,7 +72,7 @@ private void InitializeComponent() this.B_CopyToClipboard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.B_CopyToClipboard.Location = new System.Drawing.Point(12, 201); this.B_CopyToClipboard.Name = "B_CopyToClipboard"; - this.B_CopyToClipboard.Size = new System.Drawing.Size(133, 23); + this.B_CopyToClipboard.Size = new System.Drawing.Size(164, 23); this.B_CopyToClipboard.TabIndex = 3; this.B_CopyToClipboard.Text = "Copy to Clipboard"; this.B_CopyToClipboard.UseVisualStyleBackColor = true; diff --git a/PKHeX/Resources/text/fr/lang_fr.txt b/PKHeX/Resources/text/fr/lang_fr.txt index a7371ae4d..2ad98f385 100644 --- a/PKHeX/Resources/text/fr/lang_fr.txt +++ b/PKHeX/Resources/text/fr/lang_fr.txt @@ -367,8 +367,8 @@ L_Arguments = Onglet désactivé ; Toujours avec ; DO ; Génération précédent ! ErrorWindow = Erreur - Change stuff below this line, not above. ------------------------------------------------------- -L_ProvideInfo = S'il vous plaît fournir ces informations lorsque vous rapportez cette error: -B_CopyToClipboard = Copier dans les Notes +L_ProvideInfo = Veuillez fournir les informations suivantes dans votre rapport d'erreur : +B_CopyToClipboard = Copier dans le presse-papier B_Continue = Continuer B_Abort = Abandonner ! End \ No newline at end of file From 02ce104425c1c258a2b05f60b6d2ce0357ffd849 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Thu, 25 Aug 2016 22:59:29 -0500 Subject: [PATCH 10/17] Added overload to Util.Error to use ErrorWindow --- PKHeX/MainWindow/Main.cs | 8 +++--- PKHeX/Misc/ErrorWindow.cs | 3 +- PKHeX/PKM/PKX.cs | 2 +- .../Save Editors/Gen5/SAV_CGearSkin.cs | 2 +- PKHeX/Subforms/Save Editors/SAV_BoxViewer.cs | 2 +- PKHeX/Subforms/Save Editors/SAV_EventFlags.cs | 4 +-- PKHeX/Subforms/Save Editors/SAV_Wondercard.cs | 6 ++-- PKHeX/Util/FormUtil.cs | 28 +++++++++++++++++-- 8 files changed, 39 insertions(+), 16 deletions(-) diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index 1d348a793..e0cbead28 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -551,7 +551,7 @@ private void openQuick(string path, bool force = false) catch (Exception e) { Util.Error("File is in use by another program!", path, e.ToString()); return; } try { openFile(input, path, ext); } - catch (Exception e) { Util.Error("Unable to load file.", e.ToString()); } + catch (Exception e) { Util.Error("Unable to load file.", e); } } } private void openFile(byte[] input, string path, string ext) @@ -2503,7 +2503,7 @@ private void dragout_MouseDown(object sender, MouseEventArgs e) DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { newfile }), DragDropEffects.Move); } catch (Exception x) - { Util.Error("Drag & Drop Error", x.ToString()); } + { Util.Error("Drag & Drop Error", x); } Cursor = DragInfo.Cursor = DefaultCursor; File.Delete(newfile); } @@ -2559,7 +2559,7 @@ private void clickExportSAVBAK(object sender, EventArgs e) try { Directory.CreateDirectory(BackupPath); Util.Alert("Backup folder created!", $"If you wish to no longer automatically back up save files, delete the \"{BackupPath}\" folder."); } - catch { Util.Error($"Unable to create backup folder @ {BackupPath}"); } + catch(Exception ex) { Util.Error($"Unable to create backup folder @ {BackupPath}", ex); } } private void clickExportSAV(object sender, EventArgs e) { @@ -3428,7 +3428,7 @@ private void pbBoxSlot_MouseMove(object sender, MouseEventArgs e) } catch (Exception x) { - Util.Error("Drag & Drop Error:", x.ToString()); + Util.Error("Drag & Drop Error", x); } DragInfo.Reset(); Cursor = DefaultCursor; diff --git a/PKHeX/Misc/ErrorWindow.cs b/PKHeX/Misc/ErrorWindow.cs index 2e59f25f0..592222b65 100644 --- a/PKHeX/Misc/ErrorWindow.cs +++ b/PKHeX/Misc/ErrorWindow.cs @@ -11,7 +11,7 @@ namespace PKHeX.Misc { public partial class ErrorWindow : Form { - public static void ShowErrorDialog(string friendlyMessage, Exception ex, bool allowContinue) + public static DialogResult ShowErrorDialog(string friendlyMessage, Exception ex, bool allowContinue) { var lang = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName; var dialog = new ErrorWindow(lang); @@ -24,6 +24,7 @@ public static void ShowErrorDialog(string friendlyMessage, Exception ex, bool al { Application.Exit(); } + return dialogResult; } public ErrorWindow() diff --git a/PKHeX/PKM/PKX.cs b/PKHeX/PKM/PKX.cs index 8aebbcbae..5fca30531 100644 --- a/PKHeX/PKM/PKX.cs +++ b/PKHeX/PKM/PKX.cs @@ -544,7 +544,7 @@ private static void setPKXFont() AddFontMemResourceEx(fontPtr, (uint)Resources.pgldings_normalregular.Length, IntPtr.Zero, ref dummy); Marshal.FreeCoTaskMem(fontPtr); } - catch { Util.Error("Unable to add ingame font."); } + catch (Exception ex) { Util.Error("Unable to add ingame font.", ex); } } // Personal.dat diff --git a/PKHeX/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs b/PKHeX/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs index 3d0b6ea42..5128b4349 100644 --- a/PKHeX/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs +++ b/PKHeX/Subforms/Save Editors/Gen5/SAV_CGearSkin.cs @@ -46,7 +46,7 @@ private void B_ImportPNG_Click(object sender, EventArgs e) } catch (Exception ex) { - Util.Error(ex.Message); + Util.Error("An unexpected error has occurred.", ex); } } private void B_ExportPNG_Click(object sender, EventArgs e) diff --git a/PKHeX/Subforms/Save Editors/SAV_BoxViewer.cs b/PKHeX/Subforms/Save Editors/SAV_BoxViewer.cs index d7a2fffe2..d6267a547 100644 --- a/PKHeX/Subforms/Save Editors/SAV_BoxViewer.cs +++ b/PKHeX/Subforms/Save Editors/SAV_BoxViewer.cs @@ -193,7 +193,7 @@ private void pbBoxSlot_MouseMove(object sender, MouseEventArgs e) } catch (Exception x) { - Util.Error("Drag & Drop Error:", x.ToString()); + Util.Error("Drag & Drop Error", x); } DragInfo.Reset(); Cursor = DefaultCursor; diff --git a/PKHeX/Subforms/Save Editors/SAV_EventFlags.cs b/PKHeX/Subforms/Save Editors/SAV_EventFlags.cs index 4d15c321f..f80ecd218 100644 --- a/PKHeX/Subforms/Save Editors/SAV_EventFlags.cs +++ b/PKHeX/Subforms/Save Editors/SAV_EventFlags.cs @@ -324,7 +324,7 @@ private void diffSaves() } catch (Exception e) { - Util.Error(e.ToString()); + Util.Error("An unexpected error has occurred.", e); Console.Write(e); } TB_IsSet.Text = tbIsSet; @@ -344,7 +344,7 @@ private void diffSaves() } catch (Exception e) { - Util.Error(e.ToString()); + Util.Error("An unexpected error has occurred.", e); Console.Write(e); } diff --git a/PKHeX/Subforms/Save Editors/SAV_Wondercard.cs b/PKHeX/Subforms/Save Editors/SAV_Wondercard.cs index 2c72ad174..a9ddbd317 100644 --- a/PKHeX/Subforms/Save Editors/SAV_Wondercard.cs +++ b/PKHeX/Subforms/Save Editors/SAV_Wondercard.cs @@ -99,7 +99,7 @@ private void viewGiftData(MysteryGift g) } catch (Exception e) { - Util.Error("Loading of data failed... is this really a Wonder Card?", e.ToString()); + Util.Error("Loading of data failed... is this really a Wonder Card?", e); RTB.Clear(); } } @@ -390,8 +390,8 @@ private void pbBoxSlot_MouseDown(object sender, MouseEventArgs e) File.WriteAllBytes(newfile, card.Data); DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { newfile }), DragDropEffects.Move); } - catch (ArgumentException x) - { Util.Error("Drag & Drop Error:", x.ToString()); } + catch (Exception x) + { Util.Error("Drag & Drop Error", x); } File.Delete(newfile); wc_slot = -1; } diff --git a/PKHeX/Util/FormUtil.cs b/PKHeX/Util/FormUtil.cs index c76a198d9..52f880faf 100644 --- a/PKHeX/Util/FormUtil.cs +++ b/PKHeX/Util/FormUtil.cs @@ -1,4 +1,5 @@ -using System; +using PKHeX.Misc; +using System; using System.Collections.Generic; using System.Drawing; using System.IO; @@ -9,7 +10,7 @@ namespace PKHeX { public partial class Util { - // Form Translation + #region Form Translation internal static void TranslateInterface(Control form, string lang) { // Check to see if a the translation file exists in the same folder as the executable @@ -113,20 +114,40 @@ internal static void CenterToForm(Control child, Control parent) int y = parent.Location.Y + (parent.Height - child.Height) / 2; child.Location = new Point(Math.Max(x, 0), Math.Max(y, 0)); } + #endregion - // Message Displays + #region Message Displays + /// + /// Displays a dialog showing the details of an error. + /// + /// User-friendly message about the error. + /// Instance of the error's . + /// The associated with the dialog. + internal static DialogResult Error(string friendlyMessage, Exception exception) + { + System.Media.SystemSounds.Exclamation.Play(); + return ErrorWindow.ShowErrorDialog(friendlyMessage, exception, true, true); + } + + /// + /// Displays a dialog showing the details of an error. + /// + /// User-friendly message about the error. + /// The associated with the dialog. internal static DialogResult Error(params string[] lines) { System.Media.SystemSounds.Exclamation.Play(); string msg = string.Join(Environment.NewLine + Environment.NewLine, lines); return MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } + internal static DialogResult Alert(params string[] lines) { System.Media.SystemSounds.Asterisk.Play(); string msg = string.Join(Environment.NewLine + Environment.NewLine, lines); return MessageBox.Show(msg, "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning); } + internal static DialogResult Prompt(MessageBoxButtons btn, params string[] lines) { System.Media.SystemSounds.Question.Play(); @@ -152,5 +173,6 @@ public static void PanelScroll(object sender, ScrollEventArgs e) break; } } + #endregion } } From 10ddab6a42ac1ab07e32afce71e2f2c84717a759 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Thu, 25 Aug 2016 23:01:42 -0500 Subject: [PATCH 11/17] Fixed duplicate function parameter --- PKHeX/Util/FormUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PKHeX/Util/FormUtil.cs b/PKHeX/Util/FormUtil.cs index 52f880faf..7b6d454e8 100644 --- a/PKHeX/Util/FormUtil.cs +++ b/PKHeX/Util/FormUtil.cs @@ -126,7 +126,7 @@ internal static void CenterToForm(Control child, Control parent) internal static DialogResult Error(string friendlyMessage, Exception exception) { System.Media.SystemSounds.Exclamation.Play(); - return ErrorWindow.ShowErrorDialog(friendlyMessage, exception, true, true); + return ErrorWindow.ShowErrorDialog(friendlyMessage, exception, true); } /// From 114cdaa4d6e4accbaec4cc780958c6706c1f500b Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Mon, 29 Aug 2016 21:19:11 -0500 Subject: [PATCH 12/17] Added path to openQuick exceptions --- PKHeX/MainWindow/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index 61abcd458..797910709 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -549,10 +549,10 @@ private void openQuick(string path, bool force = false) else { byte[] input; try { input = File.ReadAllBytes(path); } - catch (Exception e) { Util.Error("File is in use by another program!", path, e.ToString()); return; } + catch (Exception e) { Util.Error("Unable to load file. It could be in use by another program.\nPath: " + path, e); return; } try { openFile(input, path, ext); } - catch (Exception e) { Util.Error("Unable to load file.", e); } + catch (Exception e) { Util.Error("Unable to load file.\nPath: " + path, e); } } } private void openFile(byte[] input, string path, string ext) From b12f79e79e7d389fcedc2fc7f6e2e0f88941ac8e Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Mon, 29 Aug 2016 21:22:15 -0500 Subject: [PATCH 13/17] Included user-friendly message in exception window --- PKHeX/Misc/ErrorWindow.cs | 58 ++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/PKHeX/Misc/ErrorWindow.cs b/PKHeX/Misc/ErrorWindow.cs index 592222b65..565cb1cad 100644 --- a/PKHeX/Misc/ErrorWindow.cs +++ b/PKHeX/Misc/ErrorWindow.cs @@ -80,35 +80,43 @@ public Exception Error set { _error = value; - - var details = new StringBuilder(); - details.AppendLine("Exception Details:"); - details.AppendLine(value.ToString()); - details.AppendLine(); - - details.AppendLine("Loaded Assemblies:"); - details.AppendLine("--------------------"); - try - { - foreach (var item in AppDomain.CurrentDomain.GetAssemblies()) - { - details.AppendLine(item.FullName); - details.AppendLine(item.Location); - details.AppendLine(); - } - } - catch (Exception ex) - { - details.AppendLine("An error occurred while listing the Loaded Assemblies:"); - details.AppendLine(ex.ToString()); - } - details.AppendLine("--------------------"); - - T_ExceptionDetails.Text = details.ToString(); + UpdateExceptionDetailsMessage(); } } private Exception _error; + private void UpdateExceptionDetailsMessage() + { + var details = new StringBuilder(); + details.AppendLine("Exception Details:"); + details.AppendLine(Error.ToString()); + details.AppendLine(); + + details.AppendLine("Loaded Assemblies:"); + details.AppendLine("--------------------"); + try + { + foreach (var item in AppDomain.CurrentDomain.GetAssemblies()) + { + details.AppendLine(item.FullName); + details.AppendLine(item.Location); + details.AppendLine(); + } + } + catch (Exception ex) + { + details.AppendLine("An error occurred while listing the Loaded Assemblies:"); + details.AppendLine(ex.ToString()); + } + details.AppendLine("--------------------"); + + // Include message in case it contains important information, like a file path. + details.AppendLine("User Message:"); + details.AppendLine(Message); + + T_ExceptionDetails.Text = details.ToString(); + } + private void btnCopyToClipboard_Click(object sender, EventArgs e) { Clipboard.SetText(T_ExceptionDetails.Text); From 351d4240cd7a447c3f6160b2ec1fa5eff79c8b56 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Mon, 29 Aug 2016 21:32:41 -0500 Subject: [PATCH 14/17] Removed error window resizing --- PKHeX/Misc/ErrorWindow.Designer.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PKHeX/Misc/ErrorWindow.Designer.cs b/PKHeX/Misc/ErrorWindow.Designer.cs index b7ed1f513..c662b66b5 100644 --- a/PKHeX/Misc/ErrorWindow.Designer.cs +++ b/PKHeX/Misc/ErrorWindow.Designer.cs @@ -52,9 +52,11 @@ private void InitializeComponent() // // L_Message // + this.L_Message.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.L_Message.Location = new System.Drawing.Point(9, 9); this.L_Message.Name = "L_Message"; - this.L_Message.Size = new System.Drawing.Size(363, 27); + this.L_Message.Size = new System.Drawing.Size(477, 27); this.L_Message.TabIndex = 1; this.L_Message.Text = "An unknown error has occurred."; // @@ -110,7 +112,9 @@ private void InitializeComponent() this.Controls.Add(this.L_ProvideInfo); this.Controls.Add(this.L_Message); this.Controls.Add(this.T_ExceptionDetails); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; this.Name = "ErrorWindow"; this.Text = "Error"; this.ResumeLayout(false); From 1fdbc46395992cb00f2f87eef0d14cb378b6edd1 Mon Sep 17 00:00:00 2001 From: Evan Dixon Date: Tue, 30 Aug 2016 09:03:31 -0500 Subject: [PATCH 15/17] Added project configuration for ClickOnce deployments Part of issue #199 --- PKHeX.sln | 10 ++++++++++ PKHeX/MainWindow/Main.cs | 2 +- PKHeX/PKHeX.csproj | 29 +++++++++++++++++++++++++++++ PKHeX/Util/DeployUtil.cs | 22 ++++++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 PKHeX/Util/DeployUtil.cs diff --git a/PKHeX.sln b/PKHeX.sln index e4bd67805..078a26071 100644 --- a/PKHeX.sln +++ b/PKHeX.sln @@ -11,14 +11,24 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{7C0598C9 EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + ClickOnce-Debug|x86 = ClickOnce-Debug|x86 + ClickOnce-Release|x86 = ClickOnce-Release|x86 Debug|x86 = Debug|x86 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.ClickOnce-Debug|x86.ActiveCfg = ClickOnce-Debug|x86 + {B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.ClickOnce-Debug|x86.Build.0 = ClickOnce-Debug|x86 + {B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.ClickOnce-Release|x86.ActiveCfg = ClickOnce-Release|x86 + {B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.ClickOnce-Release|x86.Build.0 = ClickOnce-Release|x86 {B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.Debug|x86.ActiveCfg = Debug|x86 {B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.Debug|x86.Build.0 = Debug|x86 {B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.Release|x86.ActiveCfg = Release|x86 {B4EFF030-C75A-49F9-A4BC-738D1B61C4AF}.Release|x86.Build.0 = Release|x86 + {8E2499BC-C11A-4809-8737-66D35A625425}.ClickOnce-Debug|x86.ActiveCfg = Debug|x86 + {8E2499BC-C11A-4809-8737-66D35A625425}.ClickOnce-Debug|x86.Build.0 = Debug|x86 + {8E2499BC-C11A-4809-8737-66D35A625425}.ClickOnce-Release|x86.ActiveCfg = Release|x86 + {8E2499BC-C11A-4809-8737-66D35A625425}.ClickOnce-Release|x86.Build.0 = Release|x86 {8E2499BC-C11A-4809-8737-66D35A625425}.Debug|x86.ActiveCfg = Debug|x86 {8E2499BC-C11A-4809-8737-66D35A625425}.Debug|x86.Build.0 = Debug|x86 {8E2499BC-C11A-4809-8737-66D35A625425}.Release|x86.ActiveCfg = Release|x86 diff --git a/PKHeX/MainWindow/Main.cs b/PKHeX/MainWindow/Main.cs index f91ed9125..f42dfc3ae 100644 --- a/PKHeX/MainWindow/Main.cs +++ b/PKHeX/MainWindow/Main.cs @@ -180,7 +180,7 @@ public Main() #region Path Variables - public static string WorkingDirectory => Environment.CurrentDirectory; + public static string WorkingDirectory => Util.IsClickonceDeployed ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "PKHeX") : Environment.CurrentDirectory; public static string DatabasePath => Path.Combine(WorkingDirectory, "db"); private static string WC6DatabasePath => Path.Combine(WorkingDirectory, "wc6"); private static string BackupPath => Path.Combine(WorkingDirectory, "bak"); diff --git a/PKHeX/PKHeX.csproj b/PKHeX/PKHeX.csproj index eae839e4b..49e2ad0dd 100644 --- a/PKHeX/PKHeX.csproj +++ b/PKHeX/PKHeX.csproj @@ -58,6 +58,28 @@ PKHeX.Program + + true + bin\x86\ClickOnce-Debug\ + DEBUG;CLICKONCE + full + x86 + false + 6 + prompt + MinimumRecommendedRules.ruleset + + + CLICKONCE + bin\x86\ClickOnce-Release\ + true + pdbonly + x86 + false + 6 + prompt + MinimumRecommendedRules.ruleset + @@ -65,6 +87,12 @@ + + + + + + @@ -302,6 +330,7 @@ + diff --git a/PKHeX/Util/DeployUtil.cs b/PKHeX/Util/DeployUtil.cs new file mode 100644 index 000000000..b63b34302 --- /dev/null +++ b/PKHeX/Util/DeployUtil.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace PKHeX +{ + public partial class Util + { + public static bool IsClickonceDeployed + { + get + { +#if CLICKONCE + return System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed; +#else + return false; +#endif + } + } + } +} From 0b4cc06da2fadd75d80869710733d05e8a9caada Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 17 Sep 2016 08:50:34 -0700 Subject: [PATCH 16/17] Update README.md --- README.md | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ed94b5dfe..137bb9758 100644 --- a/README.md +++ b/README.md @@ -1,41 +1,36 @@ PKHeX ===== +![License](https://img.shields.io/badge/License-GPLv3-blue.svg) -Pokémon GBA/NDS/3DS save editor, programmed in [C#](https://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29). +Pokémon core series save editor, programmed in [C#](https://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29). -Supports the following files originating from the Nintendo GBA, NDS, & 3DS: +Supports the following files: * Save files ("main", .sav) * Individual Pokémon entity files (.pk*) * Mystery Gift files (.pgt, .pcd, .pgf, .wc6) including conversion to .pk* * Importing teams from Decrypted Battle Videos (X/Y/OR/AS only) -* Transferring of previous generation entities (.pkm) to future generation formats and save files +* Transferring from one generation to another, converting formats along the way. Data is displayed in a view which can be edited and saved. The interface can be translated with resource/external text files so that different languages can be supported. -Pokémon Showdown sets can be imported/exported in addition to QR codes. +Pokémon Showdown sets and QR codes can be imported/exported to assist in sharing. Nintendo 3DS savedata containers use an AES MAC that cannot be emulated without the 3DS's keys, thus a resigning service is required (svdt, save_manager, or SaveDataFiler). ## Screenshots -![Main Window](http://i.imgur.com/GBub4le.png) - -### License - -PKHeX is licensed under GPLv3. Refer to LICENSE.md for more information. +![Main Window](http://i.imgur.com/QT3IxpR.png) ## Building -PKHeX can be compiled with any compiler that supports C# 6.0. +PKHeX is a Windows Forms application which requires .NET Framework v4.0. + +The executable can be built with any compiler that supports C# 6.0. ### IDE -PKHeX can be opened with MS Visual Studio and [MonoDevelop](http://www.monodevelop.com/) by importing the project with the .sln or .csproj file. - -### Command Line - -You can use [xbuild of Mono](http://mono-framework.com/Microsoft.Build): `xbuild PKHeX.sln`. +PKHeX can be opened with IDEs such as [Visual Studio](https://www.visualstudio.com/) or [MonoDevelop](http://www.monodevelop.com/) by opening the .sln or .csproj file. ### GNU/Linux From d472a51ce39ee27a88bcaab21a2b67b252f397f4 Mon Sep 17 00:00:00 2001 From: Kaphotics Date: Sat, 17 Sep 2016 12:21:23 -0700 Subject: [PATCH 17/17] 9/18/16 - New Update Changelog, shortcut list, version, and wc6db updated. Slide in a legality check for super training. --- PKHeX/Legality/Checks.cs | 7 ++++-- PKHeX/Resources/byte/wc6.pkl | Bin 251856 -> 256872 bytes PKHeX/Resources/byte/wc6full.pkl | Bin 196000 -> 205408 bytes PKHeX/Resources/text/changelog.txt | 38 +++++++++++++++++++++++++++-- PKHeX/Resources/text/shortcuts.txt | 22 +++++++++-------- PKHeX/Resources/text/version.txt | 2 +- 6 files changed, 54 insertions(+), 15 deletions(-) diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index 5c293e490..75b31c3f1 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -367,6 +367,10 @@ private LegalityCheck verifyRibbons() if (!Encounter.Valid) return new LegalityCheck(Severity.Valid, "Skipped Ribbon check due to other check being invalid."); + var TrainNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "SuperTrain").ToArray(); + if (TrainNames.Count(MissionName => ReflectUtil.GetValue(pk6, MissionName) as bool? == true) == 30 ^ pk6.SecretSuperTrainingComplete) + return new LegalityCheck(Severity.Invalid, "Super Training complete flag mismatch."); + List missingRibbons = new List(); List invalidRibbons = new List(); @@ -385,9 +389,8 @@ private LegalityCheck verifyRibbons() if (DistNames.Select(MissionName => ReflectUtil.GetValue(pk6, MissionName)).Any(Flag => Flag as bool? == true)) return new LegalityCheck(Severity.Invalid, "Distribution Super Training missions on Egg."); - var TrainNames = ReflectUtil.getPropertiesStartWithPrefix(pk6.GetType(), "SuperTrain"); if (TrainNames.Select(MissionName => ReflectUtil.GetValue(pk6, MissionName)).Any(Flag => Flag as bool? == true)) - return new LegalityCheck(Severity.Fishy, "Super Training missions on Egg."); + return new LegalityCheck(Severity.Invalid, "Super Training missions on Egg."); return new LegalityCheck(); } diff --git a/PKHeX/Resources/byte/wc6.pkl b/PKHeX/Resources/byte/wc6.pkl index 8d99c4601f5e70e08352b4e90abc5454bba4c853..f5d52005e5d121da9478d9423da680ecae6ca67f 100644 GIT binary patch delta 1875 zcmcbxp8v%)e#Ujv1&x_R8O^548!?%(DlRl;44fD!F4-f$jsXr71Q?;{qEM7%a{(tWjVvSQoHy^24u2tX)7e&4Ff0 zGcmkjMK+UxL6u=QLl8S;QW%LVyOlxBY8eZ%Ssv?Y%r5g3j+lXpkh)66Ph zFfJ4k=Tv6^d90G5c>2c>X6<2O8}}PlkgxI?$`}$S?-jFWXJDXJhNGiZj3$#0N@#M2 z0TW0vLkTFEOmoV$^ zw*A0WW&x(n9E@Cylerk@Pd>?7yjg~6uJiPrzKo)i&$)h{ywf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aRN?zKAh5)(1=fTfB!X_`RRzO_vLOv)4PmtKrGoVJI3K!Q zfaeOw*8wcA>n*R-HpTvs>!|-CxUsABLLmpy*P|a@L*J7CK2v80z|VVEEL{J}!+dXX zAQVkBw3cajUEERRSP#{5C;gO;HLj_1-Y7i6T@B8iYnqHc>5m=mPCPk3VRPx|$GhXI z95xA7?%ZJ(jNCNx27bNL_WiBFjjJW&1`aMd((eRp)X}-Fx0Q|gl`%opS5(|i*i+4= zK}6ev<5rCHA&&r#$Y1}i zx!BJ}bxLV3n_$W(T`W_lOdVv2I_1qaR-{vowXhVOGVWz&oienSt_PoIH<;qWqoz|L I18jT8zdjI&XaE2J delta 98 zcmaEGglEBT?&bi8_5cUQ?Ewxk-Kkm(20_AT>3D%Z>gshl!{seyU>lI=`;vL-8-hiweglGyBEE5Hl@2 conversion. Thanks SciresM! + - Added: Super Secret Training Completed flag. Thanks SciresM! + - Added: Program will now check for updates when the program starts. If an update is available, a URL label will appear. + - Added: Mystery Gift event database browser. Currently only views wc6, can be loaded to tabs! Hotkey is CTRL-G. + - Added: Gen 4 & 5 Pokedex form flags will be set when the Pokémon is set to the save file. + - Added: Hall of Fame time in Trainer editor. Thanks ricksee! + - Added: Gen 1/2/3 Met Location and Item strings for Spanish and Chinese games. Thanks ajtudela & easyworld! + - Added: Spiky Eared Pichu sprite. + - Added: MetDate/EggMetDate property setting in the Batch Editor (refer to FAQ, yyyyMMdd format). Thanks AvantGourd! + - Added: Box Viewer popup for easier box management. Doubleclick the "Box" tab. To open more than one, hold Shift while double clicking. + - Fixed: Non-box drag&drop slots will set the cursor to the slot's sprite while dragging, just like Box Slots. + - Fixed: O-Power editing saving will now save back to the save file. + - Fixed: Improved save detection for gen4/5 games, including saves that were just (re)started. + - Fixed: Gen4 ribbon editor give-all no longer throws an exception. + - Fixed: Changed event constants from signed to unsigned. Thanks evandixon! + - Fixed: Changing Unown's form as a pk3 will now update the PID. Thanks NinFanBoyFTW! + - Fixed: EncounterType dropdown now appears at the correct time. Thanks JSS! + - Fixed: HM07/HM08 inventory editing for gen4/5. Thanks msbhvn & Liger0! + - Fixed: Setting gen4 HGSS balls corrected. Thanks theSLAYER! + - Fixed: Gen3 inventory editor give-all disabled, as Bag is too small to give all items for a given pouch. Thanks Liger0! + - Fixed: Gen1/2/3 sub-editors erasing changes made to box Pokémon. Thanks SciresM, MichiS97! + - Fixed: Tangled Feet Rayquaza in Gen3. Thanks Delta Blast Burn! + - Legality: Level 20 Gallade is now recognized as legal. Thanks Rohul1997! + - Legality: Gen4 starters disallowed from having Gen3/4 balls. Thanks /u/Subject21_J + - Legality: Added Super Training legality checks. Thanks sora10pls! + - Changed: Inventory Editing now uses prettier sprites for each tab. + - Changed: Showdown Set parsing updated to account for user error when manually typing a set instead of exporting from Showdown as intended. + - Changed: Backed up save file names are now easier on the eye. Gen 1-5 saves will use played time, Gen 6 use the last saved datetime. + - Changed: First 3 tabs of PKM editor (left side) redesigned to fit and collapse controls for all the different games that are supported. + - Changed: Tabs with no controls visible will be hidden. Example: Hiding Box Tab with ORAS Demo save loaded. + - Changed: Met locations are now top-sorted with the locations available to the Origin Game. \ No newline at end of file diff --git a/PKHeX/Resources/text/shortcuts.txt b/PKHeX/Resources/text/shortcuts.txt index c15e811ee..1739f33a1 100644 --- a/PKHeX/Resources/text/shortcuts.txt +++ b/PKHeX/Resources/text/shortcuts.txt @@ -1,6 +1,5 @@ If you are having issues viewing certain symbols/text: Options -> Toggle Font. - // Main Window CTRL-O: Open @@ -10,6 +9,7 @@ CTRL-B: Export BAK CTRL-Q: Quit CTRL-D: Open Database +CTRL-G: Open Mystery Gift Database CTRL-R: Open Box Report CTRL-P: Open About PKHeX CTRL-T: Import Showdown Set @@ -41,17 +41,16 @@ Click on the OT label to set relevant details to that of the save file. Drop WC6/PGF/PCD/PGT to convert to PK6 in the main tabs. - Hold CTRL to open the Wonder Card interface when opening a WC6. -// Party / Battle Box -- Double click to export team to Showdown set format. - // Save File -Click on the Save File path (above Boxes): Auto-detect/Reload save. - - Shift skips SaveDataFiler +Doubleclick on the SAV Tab: Auto-detect/Reload latest save. // Boxes -Control-Click Box Tab: Sort Boxes. +Control-Click Box Tab: Sort Current Box contents. +Control-Shift-Click Box Tab: Sort All Boxes. +Alt-Click Box Tab: Delete Current Box contents. +Alt-Shift-Click Box Tab: Delete All Boxes. Control-Drag a Box Slot to Copy-Overwrite Alt-Drag a Box Slot to Delete-Overwrite @@ -61,17 +60,20 @@ Control-Click a slot to load slot to tabs. Shift-Click a slot to set tabs to slot. Alt-Click a slot to delete the data in slot. -Doubleclick on the Party or Battle Box label to export Showdown/Smogon Set (Team) to Clipboard. +Doubleclick the Box tab to open up a new Box Viewer. Only one is allowed at a time, unless you hold shift when doubleclicking. +- Note: Having multiple instances of the same box open and making changes to that box will not re-sync the box sprites until the box is reloaded. +// Party / Battle Box +Doubleclick on the Party or Battle Box label to export Showdown/Smogon Set (Team) to Clipboard. // Misc Editors INVENTORY: -- Alt-Click loading a pouch will give all items with quantity x995. *1 for TMHM/Key. +- Holding ALT when clicking Give All will clear all items for that pouch. POKEPUFF: - Control Click the All Button to give un-exceptional Pokepuffs. - Control Click the Sort Button to sort in reverse. -WONDERCARD: +MYSTERY GIFT: - Alt-Click QR to import from QR image. \ No newline at end of file diff --git a/PKHeX/Resources/text/version.txt b/PKHeX/Resources/text/version.txt index 9477a5f07..ebc887977 100644 --- a/PKHeX/Resources/text/version.txt +++ b/PKHeX/Resources/text/version.txt @@ -1 +1 @@ -20160830 \ No newline at end of file +20160918 \ No newline at end of file