Private
Public Access
Changed unit test settings
This commit is contained in:
1 parent
8a17d77510
commit
54de63eeb3
6 files changed
+214
-16
No files matched your search
@@ -84,7 +84,7 @@ namespace Advanced_Software_Engineering {
|
||||
string GetDescription();
|
||||
}
|
||||
|
||||
class MoveTo : Verb {
|
||||
public class MoveTo : Verb {
|
||||
|
||||
protected Drawer drawer;
|
||||
protected Point moveToPoint;
|
||||
@@ -109,7 +109,7 @@ namespace Advanced_Software_Engineering {
|
||||
|
||||
}
|
||||
|
||||
class DrawTo : Verb {
|
||||
public class DrawTo : Verb {
|
||||
protected Drawer drawer;
|
||||
protected Point moveToPoint;
|
||||
|
||||
|
||||
@@ -3,10 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Advanced_Software_Engineering {
|
||||
class Commander {
|
||||
public class Commander {
|
||||
|
||||
Graphics graphics;
|
||||
List<Verb> commands = new List<Verb>();
|
||||
@@ -28,6 +27,10 @@ namespace Advanced_Software_Engineering {
|
||||
drawer.ResetDrawer();
|
||||
}
|
||||
|
||||
public Commander(string command) {
|
||||
Console.WriteLine("Warning! No graphics context!!!");
|
||||
}
|
||||
|
||||
public Commander(Graphics graphics, string rawCommands) {
|
||||
this.graphics = graphics;
|
||||
this.drawer = new Drawer(this.graphics);
|
||||
@@ -61,14 +64,19 @@ namespace Advanced_Software_Engineering {
|
||||
Console.WriteLine(verb.GetDescription());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine("Error: Unknown error.");
|
||||
|
||||
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();
|
||||
|
||||
try {
|
||||
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();
|
||||
}
|
||||
catch(Exception windowError) {
|
||||
Console.WriteLine("Failed to display error window!");
|
||||
}
|
||||
RemoveAllCommands();
|
||||
}
|
||||
}
|
||||
@@ -87,9 +95,17 @@ namespace Advanced_Software_Engineering {
|
||||
drawer.ResetDrawer();
|
||||
}
|
||||
|
||||
public string ExplainCommands() {
|
||||
string desc = "";
|
||||
foreach(Verb command in commands) {
|
||||
desc += command.GetDescription() + Environment.NewLine;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Drawer {
|
||||
public class Drawer {
|
||||
protected static Color defaultColor = Color.Black;
|
||||
protected static float defaultWidth = 1f;
|
||||
protected bool fill = false;
|
||||
|
||||
Reference in new issue
Block a user