private void readFigures(SqlDataReader dataReader) { while (dataReader.Read()) { String figureString = dataReader.GetString(0); Regex regex = new Regex(@"\[(\w*)\][\d;\.]*:"); MatchCollection matches = regex.Matches(figureString); if (matches.Count > 0) { Figure figure = new Figure(); foreach (Match match in matches) { regex = new Regex(@"[\d\.]+"); Regex lineReg = new Regex(@"\[\w+\]"); MatchCollection coordinates = regex.Matches(match.Value); Match type = lineReg.Match(match.Value); FigurePart figurePart = new FigurePart(type.Value, 000f, 1420f); if (coordinates.Count > 0) { foreach (Match coord in coordinates) { figurePart.addCoord(coord.Value); } } figure.addPart(figurePart); } mFigures.Add(figure); } //"[GERADE];91.700;00;00;70.900:[GERADE];183.400;70.900;91.700;00:[GERADE];183.400;173.000;183.400;70.900:[GERADE];00;173.000;183.400;173.000:[GERADE];00;70.900;00;173.000:" } dataReader.Close(); }
public void addPart(FigurePart part) { mParts.Add(part); }