public async Task <MemoMap> ReadAllAsync()
        {
            Rewind();

            var map   = new MemoMap();
            var lines = new List <Match>();

            while (!EndOfStream)
            {
                var line = await ReadLineAsync();

                var match = OrdinalRegex.Match(line);
                if (match.Success)
                {
                    if (lines.Count > 0)
                    {
                        var measure = MemoMeasure.Parse(lines);
                        measure.Ordinal = map.Measures.Count + 1;
                        map.Measures.Add(measure);
                        lines.Clear();
                    }
                    var ordinal = int.Parse(match.Groups["ordinal"].Value);
                    Debug.Assert(map.Measures.Count + 1 == ordinal);
                    continue;
                }

                match = MemoLineRegex.Match(line);
                if (match.Success)
                {
                    lines.Add(match);
                    continue;
                }

                Debug.Assert(string.IsNullOrEmpty(line));
            }

            return(map);
        }
示例#2
0
 public static string MapToString(MemoMap map)
 {
     throw new NotImplementedException();
 }
示例#3
0
        public static bool CheckMap(MemoMap map, bool repair, TextWriter logWriter)
        {
            var logger = GetLogger(logWriter);

            throw new NotImplementedException();
        }