Private
Public Access
Reformatted Commander
This commit is contained in:
1 parent
aeea08f021
commit
3ba8d7b944
1 file changed
+24
-17
@@ -34,24 +34,31 @@ namespace Advanced_Software_Engineering {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ProcessCommands(string rawCommands) {
|
public void ProcessCommands(string rawCommands) {
|
||||||
//ignore case
|
try {
|
||||||
rawCommands = rawCommands.ToLower();
|
//ignore case
|
||||||
Console.WriteLine("Processing:\n" + rawCommands);
|
rawCommands = rawCommands.ToLower();
|
||||||
|
Console.WriteLine("Processing:\n" + rawCommands);
|
||||||
|
|
||||||
//isolate commands
|
//isolate commands
|
||||||
string[] commands = rawCommands.Split(Environment.NewLine.ToCharArray());
|
string[] commands = rawCommands.Split(Environment.NewLine.ToCharArray());
|
||||||
|
|
||||||
Console.WriteLine("\nThe rawCommand processed:");
|
Console.WriteLine("\nThe rawCommand processed:");
|
||||||
foreach (string rawCommand in commands) {
|
foreach (string rawCommand in commands) {
|
||||||
if (rawCommand == "") continue;
|
if (rawCommand == "") continue;
|
||||||
AddCommand(VerbFactory.MakeVerb(drawer, rawCommand));
|
AddCommand(VerbFactory.MakeVerb(drawer, rawCommand));
|
||||||
Console.WriteLine(rawCommand);
|
Console.WriteLine(rawCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("\n\nHere is what the program is going to do:");
|
||||||
|
Console.WriteLine("Set origin to 0, 0");
|
||||||
|
foreach (Verb verb in this.commands) {
|
||||||
|
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();
|
||||||
|
|
||||||
Console.WriteLine("\n\nHere is what the program is going to do:");
|
|
||||||
Console.WriteLine("Set origin to 0, 0");
|
|
||||||
foreach(Verb verb in this.commands) {
|
|
||||||
Console.WriteLine(verb.GetDescription());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user