|
using System;
using System.Text.RegularExpressions;
namespace LDrawPartLib
{
public class MetaCommand : CommandLine
{
string[] _commands = new string[4];
private MetaCommand() { }
public MetaCommand(string line) : base(line) { }
public MetaCommandType Type { get; set; }
public string[] Commands {
get {
return _commands;
}
}
protected override void SetValues() {
base.SetValues();
MatchCollection commands = WordsEx.Matches(Line);
//_commands[0] = "NOCERTIFY";
//_commands[1] = Winding.CCW.ToString();
//_commands[2] = null;
//_commands[3] = Boolean.FalseString;
if (commands.Count > 2) {
if (commands[1].Value == "BFC") {
this.Type = MetaCommandType.BFC;
ParseBFC(commands);
}
}
}
private void ParseBFC(MatchCollection commands) {
for (int i = 0; i < commands.Count; i++) {
string command = commands[i].Value.ToUpper();
switch (command) {
case "CERTIFY":
case "NOCERTIFY":
_commands[0] = command;
break;
case "CW":
_commands[1] = Winding.CW.ToString();
break;
case "CCW":
_commands[1] = Winding.CCW.ToString();
break;
case "INVERTNEXT":
_commands[3] = Boolean.TrueString;
break;
}
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.