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--;
}