/// <summary>
        /// 不包含parse field
        /// </summary>
        internal void Parse()
        {
            Dependents.Clear();
            Summarys.Clear();
            Fields.Clear();
            List <List <Line> > fields = ParseFieldLine(ParseMsgElement());

            foreach (List <Line> list in fields)
            {
                ProtoBufferField field = new ProtoBufferField(this, list);
                Fields.Add(field);
            }
        }
Example #2
0
        internal void Parse()
        {
            Summarys.Clear();
            List <Line> list = new List <Line>();

            foreach (Line line in Lines)
            {
                if (line.Content.StartsWith("//"))
                {
                    if (line.Content.Length > 2)
                    {
                        Summarys.Add(line.Content.Substring(2).Trim());
                    }
                }
                else
                {
                    list.Add(line);
                }
            }
            ParseInfos(list);

            foreach (ProtoBufferField field in Message.Fields)
            {
                if (Equals(field))
                {
                    continue;
                }
                if (field.FieldNumber == FieldNumber)
                {
                    throw new ProtoBufferException(string.Format("在文件名{0},message:{1},FieldNumber:{2}重复。{3}", Message.File.FileName, Message.Name, FieldNumber, list[0].ToString()));
                }
                if (Name.Equals(field.Name))
                {
                    throw new ProtoBufferException(string.Format("在文件名{0},message:{1},名称{2}重复,FieldNumber:{3}。{4}", Message.File.FileName, Message.Name, Name, FieldNumber, list[0].ToString()));
                }
            }
        }