/// <summary>
        /// The service descriptor proto.
        /// </summary>
        /// <param name="totalLength">
        /// The total length.
        /// </param>
        /// <param name="sd">
        /// The sd.
        /// </param>
        private void ServiceDescriptorProto(uint totalLength, ServiceDescriptor sd)
        {
            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;
                            sd.Name = GetString(length);
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2}, name = {3}", type, no, length, sd.Name));
                            ix += (int)length;
                            totalLength -= length;
                            break;
                        }

                    case 2: // MethodDescriptorProto options
                        {
                            uint length;
                            var ixl = GetVarint(out length);
                            ix += ixl;
                            totalLength -= (uint)ixl;
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2} - MethodDescriptorProto", type, no, length));
                            var md = new MethodDescriptor();
                            sd.Methods.Add(md);
                            MethodDescriptorProto(length, md);
                            totalLength -= length;
                            break;
                        }

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

                            ServiceOptions(length, sd.Options);
                            totalLength -= length;
                            break;
                        }
                }
            }

            intend--;
        }
        /// <summary>
        /// The method descriptor proto.
        /// </summary>
        /// <param name="totalLength">
        /// The total length.
        /// </param>
        /// <param name="md">The method descriptor.</param>
        private void MethodDescriptorProto(uint totalLength, MethodDescriptor md)
        {
            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;
                            md.Name = GetString(length);
                            Write(string.Format("Type = {0}, F#= {1}, Length = {2}, name = {3}", type, no, length, md.Name));
                            ix += (int)length;
                            totalLength -= length;
                            break;
                        }

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

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

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

                            MethodOptions(length, md.Options);
                            totalLength -= length;
                            break;
                        }
                }
            }

            intend--;
        }