public static bool TryScan(string line, out IScanable scanned) { scanned = null; if (!Regex.IsMatch(line, RegEx)) { return(false); } string type = Regex.Match(line, "(font|lib)").Value; string name = Regex.Match(line, RegExHelper.File).Value; name = name.Trim('\''); string alias = Regex.Match(line, "as " + RegExHelper.Variable + ";").Value; alias = alias.Substring(3, alias.Length - 4); switch (type) { case "font": scanned = new FontImport(name, alias); break; case "lib": scanned = new LibraryImport(name, alias); break; default: throw new NotImplementedException("Unkown Type: " + type + " in Line '" + line + "'."); } return(true); }
public static bool TryScan(CodeReader reader, out IScanable scanned) { string line = reader.NextLine(); return(TryScan(line, out scanned)); }