diff --git a/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj b/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj index b2ac684..75a78ef 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj +++ b/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj @@ -133,6 +133,7 @@ True Resources.resx + True SettingsSingleFileGenerator @@ -159,5 +160,15 @@ false + + + Always + + + + + + + \ No newline at end of file diff --git a/Advanced Software Engineering/Advanced Software Engineering/Commander.cs b/Advanced Software Engineering/Advanced Software Engineering/Commander.cs index bb267d4..589c913 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Commander.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/Commander.cs @@ -56,9 +56,14 @@ namespace Advanced_Software_Engineering { } } catch (Exception e) { - new ErrorWindow("Error parsing commands", "The program phraser has encountered an error.", e.Message + Environment.NewLine + e.StackTrace, ErrorWindow.ERROR_MESSAGE).Show(); + new ErrorWindow( + "Unexpected error parsing commands", + "The program phraser has encountered an undexpected error." + Environment.NewLine, + e.Message + Environment.NewLine + e.StackTrace, + ErrorWindow.ERROR_MESSAGE + ).Show(); + RemoveAllCommands(); - } } diff --git a/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.Designer.cs b/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.Designer.cs index 2bcb9aa..663db46 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.Designer.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.Designer.cs @@ -48,9 +48,11 @@ // // pictureBox1 // + this.pictureBox1.Image = global::Advanced_Software_Engineering.Properties.Resources.warning; this.pictureBox1.Location = new System.Drawing.Point(6, 19); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(56, 60); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // diff --git a/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.cs b/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.cs index 63fb531..f81a567 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/ErrorWindow.cs @@ -16,11 +16,21 @@ namespace Advanced_Software_Engineering { public const int WARNING_MESSAGE = 1; public const int INFO_MESSAGE = 2; + protected Dictionary IMAGEDIR = new Dictionary { + { ERROR_MESSAGE, Properties.Resources.error }, + { WARNING_MESSAGE, Properties.Resources.warning }, + { INFO_MESSAGE, Properties.Resources.info3 } + }; + public ErrorWindow() { InitializeComponent(); this.Text = "Error"; label1.Text = "An error has occured"; desc = "None"; + + SetPicture(ERROR_MESSAGE); + + Focus(); } public ErrorWindow(string title, string brief, string desc, int type) { @@ -29,18 +39,15 @@ namespace Advanced_Software_Engineering { label1.Text = brief; this.desc = desc; - switch(type) { - case INFO_MESSAGE: + SetPicture(type); - break; - case WARNING_MESSAGE: + Focus(); - break; + } - case ERROR_MESSAGE: - default: - break; - } + protected void SetPicture(int type) { + pictureBox1.Image = IMAGEDIR[type]; + pictureBox1.Refresh(); } private void button1_Click(object sender, EventArgs e) { diff --git a/Advanced Software Engineering/Advanced Software Engineering/Images/error.png b/Advanced Software Engineering/Advanced Software Engineering/Images/error.png new file mode 100644 index 0000000..1c31c88 Binary files /dev/null and b/Advanced Software Engineering/Advanced Software Engineering/Images/error.png differ diff --git a/Advanced Software Engineering/Advanced Software Engineering/Images/info3.png b/Advanced Software Engineering/Advanced Software Engineering/Images/info3.png new file mode 100644 index 0000000..1982c24 Binary files /dev/null and b/Advanced Software Engineering/Advanced Software Engineering/Images/info3.png differ diff --git a/Advanced Software Engineering/Advanced Software Engineering/Images/warning.png b/Advanced Software Engineering/Advanced Software Engineering/Images/warning.png new file mode 100644 index 0000000..03add7a Binary files /dev/null and b/Advanced Software Engineering/Advanced Software Engineering/Images/warning.png differ diff --git a/Advanced Software Engineering/Advanced Software Engineering/Properties/Resources.Designer.cs b/Advanced Software Engineering/Advanced Software Engineering/Properties/Resources.Designer.cs index cb82c6c..c7b985d 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Properties/Resources.Designer.cs +++ b/Advanced Software Engineering/Advanced Software Engineering/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace Advanced_Software_Engineering.Properties -{ - - +namespace Advanced_Software_Engineering.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,53 +19,75 @@ namespace Advanced_Software_Engineering.Properties // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Advanced_Software_Engineering.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap error { + get { + object obj = ResourceManager.GetObject("error", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap info3 { + get { + object obj = ResourceManager.GetObject("info3", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap warning { + get { + object obj = ResourceManager.GetObject("warning", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/Advanced Software Engineering/Advanced Software Engineering/Properties/Resources.resx b/Advanced Software Engineering/Advanced Software Engineering/Properties/Resources.resx index af7dbeb..ff14d44 100644 --- a/Advanced Software Engineering/Advanced Software Engineering/Properties/Resources.resx +++ b/Advanced Software Engineering/Advanced Software Engineering/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,19 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\info3.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Advanced Software Engineering/Advanced Software Engineering/Resources/error.png b/Advanced Software Engineering/Advanced Software Engineering/Resources/error.png new file mode 100644 index 0000000..1c31c88 Binary files /dev/null and b/Advanced Software Engineering/Advanced Software Engineering/Resources/error.png differ diff --git a/Advanced Software Engineering/Advanced Software Engineering/Resources/info3.png b/Advanced Software Engineering/Advanced Software Engineering/Resources/info3.png new file mode 100644 index 0000000..1982c24 Binary files /dev/null and b/Advanced Software Engineering/Advanced Software Engineering/Resources/info3.png differ diff --git a/Advanced Software Engineering/Advanced Software Engineering/Resources/warning.png b/Advanced Software Engineering/Advanced Software Engineering/Resources/warning.png new file mode 100644 index 0000000..03add7a Binary files /dev/null and b/Advanced Software Engineering/Advanced Software Engineering/Resources/warning.png differ