AnalyzeRawProtobuf.Program.EnumDescriptorProto C# (CSharp) Method

EnumDescriptorProto() private method

The enum descriptor proto.
private EnumDescriptorProto ( uint totalLength, EnumDescriptor ed ) : void
totalLength uint /// The total length. ///
ed EnumDescriptor /// The enum descriptor. ///
return void
        private void EnumDescriptorProto(uint totalLength, EnumDescriptor ed)
        {
            intend++;

            while (totalLength != 0)
            {
                int type, no;
                var l = GetTypeAndFieldNo(out type, out no);
                ix += l;
                totalLength -= (uint)l;

                switch (no)
                {
                    case 1: // string name
                        {
                            uint length;
                            var ixl = GetVarint(out length);
                            ix += ixl;
                            totalLength -= (uint)ixl;
                            ed.Name = GetString(length);
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2}, Name = {3}", type, no, length, ed.Name));
                            ix += (int)length;
                            totalLength -= length;
                            break;
                        }

                    case 2: // EnumValueDescriptorProto value
                        {
                            uint length;
                            var ixl = GetVarint(out length);
                            ix += ixl;
                            totalLength -= (uint)ixl;
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2} - EnumValueDescriptorProto", type, no, length));
                            var evd = new EnumValueDescriptor();
                            ed.Values.Add(evd);
                            EnumValueDescriptorProto(length, evd);
                            totalLength -= length;
                            break;
                        }

                    case 3: // EnumOptions options
                        {
                            uint length;
                            var ixl = GetVarint(out length);
                            ix += ixl;
                            totalLength -= (uint)ixl;
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2} - EnumOptions", type, no, length));
                            if (ed.Options == null)
                            {
                                ed.Options = new EnumOptions();
                            }

                            EnumOptions(length, ed.Options);
                            totalLength -= length;
                            break;
                        }
                }
            }

            intend--;
        }