AnalyzeRawProtobuf.Program.FieldDescriptorProto C# (CSharp) Method

FieldDescriptorProto() private method

The field descriptor proto.
private FieldDescriptorProto ( uint totalLength, FieldDescriptor fd ) : void
totalLength uint /// The total length. ///
fd FieldDescriptor /// The field descriptor. ///
return void
        private void FieldDescriptorProto(uint totalLength, FieldDescriptor fd)
        {
            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;
                            fd.Name = GetString(length);
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2}, Name = {3}", type, no, length, fd.Name));
                            ix += (int)length;
                            totalLength -= length;
                            break;
                        }

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

                    case 3: // int32 number
                        {
                            uint value;
                            var ixl = GetVarint(out value);
                            ix += ixl;
                            totalLength -= (uint)ixl;
                            fd.Number = (int)value;
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2}, number = {3}", type, no, ixl, value));
                            break;
                        }

                    case 4: // Label label
                        {
                            uint value;
                            var ixl = GetVarint(out value);
                            ix += ixl;
                            totalLength -= (uint)ixl;
                            fd.Label = (FieldDescriptor.Labels)value;
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2}, label = {3}", type, no, ixl, value));
                            break;
                        }

                    case 5: // Type type
                        {
                            uint value;
                            var ixl = GetVarint(out value);
                            ix += ixl;
                            totalLength -= (uint)ixl;
                            fd.Type = (FieldDescriptor.Types)value;
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2}, type = {3}", type, no, ixl, value));
                            break;
                        }

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

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

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

                            FieldOptions(length, fd.Options);
                            totalLength -= length;
                            break;
                        }

                    case 9: // int32 oneof_index
                        {
                            uint value;
                            var ixl = GetVarint(out value);
                            ix += ixl;
                            totalLength -= (uint)ixl;
                            fd.OneofIndex = (int)value;
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2}, oneof_index = {3}", type, no, ixl, value));
                            break;
                        }
                }
            }

            intend--;
        }