private void DescriptorProto(uint totalLength, MessageDescriptor 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: // FieldDescriptorProto[] field
{
uint length;
var ixl = GetVarint(out length);
ix += ixl;
totalLength -= (uint)ixl;
Write(string.Format("Type = {0}, F#= {1}, Length = {2} - FieldDescriptorProto field", type, no, length));
var fd = new FieldDescriptor();
md.Fields.Add(fd);
FieldDescriptorProto(length, fd);
totalLength -= length;
break;
}
case 3: // DescriptorProto[] nested_type
{
uint length;
var ixl = GetVarint(out length);
ix += ixl;
totalLength -= (uint)ixl;
Write(string.Format("Type = {0}, F#= {1}, Length = {2} - DescriptorProto", type, no, length));
var msg = new MessageDescriptor();
md.NestedTypes.Add(msg);
DescriptorProto(length, msg);
totalLength -= length;
break;
}
case 4: // EnumDescriptorProto[] enum_type
{
uint length;
var ixl = GetVarint(out length);
ix += ixl;
totalLength -= (uint)ixl;
Write(string.Format("Type = {0}, F#= {1}, Length = {2} - EnumDescriptorProto", type, no, length));
var ed = new EnumDescriptor();
md.EnumTypes.Add(ed);
EnumDescriptorProto(length, ed);
totalLength -= length;
break;
}
case 5: // ExtensionRange[] extension_range
{
uint length;
var ixl = GetVarint(out length);
ix += ixl;
totalLength -= (uint)ixl;
Write(string.Format("Type = {0}, F#= {1}, Length = {2} - ExtensionRange", type, no, length));
var er = new MessageDescriptor.ExtensionRange();
md.ExtensionRanges.Add(er);
ExtensionRange(length, er);
totalLength -= length;
break;
}
case 6: // FieldDescriptorProto[] extension
{
uint length;
var ixl = GetVarint(out length);
ix += ixl;
totalLength -= (uint)ixl;
Write(string.Format("Type = {0}, F#= {1}, Length = {2} - FieldDescriptorProto extension", type, no, length));
var fd = new FieldDescriptor();
md.Fields.Add(fd);
FieldDescriptorProto(length, fd);
totalLength -= length;
break;
}
case 7: // MessageOptions options
{
uint length;
var ixl = GetVarint(out length);
ix += ixl;
totalLength -= (uint)ixl;
Write(string.Format("Type = {0}, F#= {1}, Length = {2} - MessageOptions", type, no, length));
if (md.Options == null)
{
md.Options = new MessageOptions();
}
MessageOptions(length, md.Options);
totalLength -= length;
break;
}
case 8: // OneofDescriptorProto[] oneof_decl
{
uint length;
var ixl = GetVarint(out length);
ix += ixl;
totalLength -= (uint)ixl;
Write(string.Format("Type = {0}, F#= {1}, Length = {2} - OneofDescriptorProto", type, no, length));
var od = new OneofDescriptor();
md.OneofDecl.Add(od);
OneofDescriptorProto(length, od);
totalLength -= length;
break;
}
}
}
intend--;
}