Reformatted Commander

This commit is contained in:
Lukasz Baldyga committed 2020-10-19 18:35:17 +01:00
1 parent aeea08f021
commit 3ba8d7b944
1 file changed
+10 -3
@@ -34,6 +34,7 @@ namespace Advanced_Software_Engineering {
} }
public void ProcessCommands(string rawCommands) { public void ProcessCommands(string rawCommands) {
try {
//ignore case //ignore case
rawCommands = rawCommands.ToLower(); rawCommands = rawCommands.ToLower();
Console.WriteLine("Processing:\n" + rawCommands); Console.WriteLine("Processing:\n" + rawCommands);
@@ -50,9 +51,15 @@ namespace Advanced_Software_Engineering {
Console.WriteLine("\n\nHere is what the program is going to do:"); Console.WriteLine("\n\nHere is what the program is going to do:");
Console.WriteLine("Set origin to 0, 0"); Console.WriteLine("Set origin to 0, 0");
foreach(Verb verb in this.commands) { foreach (Verb verb in this.commands) {
Console.WriteLine(verb.GetDescription()); Console.WriteLine(verb.GetDescription());
} }
} 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();
RemoveAllCommands();
}
} }
public void ProcessCommandsAndExecute(string rawCommands) { public void ProcessCommandsAndExecute(string rawCommands) {
@@ -101,7 +108,7 @@ namespace Advanced_Software_Engineering {
public void SetPenColor(Color color) => pen.Color = color; public void SetPenColor(Color color) => pen.Color = color;
public void SetPenWidth(float width) => pen.Width = width; public void SetPenWidth(float width) => pen.Width = width;
public void SetFillColor(Color color) => ((SolidBrush) brush).Color = color; public void SetFillColor(Color color) => ((SolidBrush)brush).Color = color;
public void DrawLine(Point point) { public void DrawLine(Point point) {
graphics.DrawLine(pen, penPosition, point); graphics.DrawLine(pen, penPosition, point);
@@ -128,7 +135,7 @@ namespace Advanced_Software_Engineering {
//Doesn't move pen //Doesn't move pen
public void DrawLines(GraphicsPath path) { public void DrawLines(GraphicsPath path) {
path.Widen(pen); path.Widen(pen);
if(fill) graphics.FillPath(brush, path); if (fill) graphics.FillPath(brush, path);
graphics.DrawPath(pen, path); graphics.DrawPath(pen, path);
} }