private static IEnumerable <KeyValuePair <char, IList <float> > > GetCommands(string text) { var parser = new PathParser(text); float x1; float y1; float x2; float y2; float x3; float y3; var action = '\0'; while (!parser.Eof) { if (parser.TryGetCommand(out var cmd)) { action = cmd; } switch (char.ToUpper(action)) { case 'Z': yield return(new KeyValuePair <char, IList <float> >(action, null)); break; case 'M': if (parser.TryGetValue(out x1, out y1)) { yield return(new KeyValuePair <char, IList <float> >(action, new List <float>() { x1, y1 })); } action = action == 'M' ? 'L' : 'l'; break; case 'L': if (parser.TryGetValue(out x1, out y1)) { yield return(new KeyValuePair <char, IList <float> >(action, new List <float>() { x1, y1 })); } break; case 'T': if (parser.TryGetValue(out x1, out y1)) { yield return(new KeyValuePair <char, IList <float> >(action, new List <float>() { x1, y1 })); } break; case 'H': case 'V': if (parser.TryGetValue(out x1)) { yield return(new KeyValuePair <char, IList <float> >(action, new List <float>() { x1 })); } break; case 'C': if (parser.TryGetValue(out x1, out y1, out x2, out y2, out x3, out y3)) { yield return(new KeyValuePair <char, IList <float> >(action, new List <float>() { x1, y1, x2, y2, x3, y3 })); } break; case 'S': case 'Q': if (parser.TryGetValue(out x1, out y1, out x2, out y2)) { yield return(new KeyValuePair <char, IList <float> >(action, new List <float>() { x1, y1, x2, y2 })); } break; case 'A': if (parser.TryGetArcValue(out x1, out x2, out x3, out var flag1, out var flag2, out y1, out y2)) { yield return(new KeyValuePair <char, IList <float> >(action, new List <float>() { x1, x2, x3, flag1, flag2, y1, y2 })); } break; default: parser.TryGetValue(out x1); break; } } }