public static void WriteDescriptors(TextWriter writer, byte[] buffer, int offset, int length)
 {
     while (length > 0)
     {
         if (length < 2)
         {
             writer.WriteLine("Unused buffer " + (object)length);
             break;
         }
         byte code = buffer[offset];
         byte num  = buffer[offset + 1];
         offset += 2;
         length -= 2;
         TsDescriptorType descriptorType = TsDescriptorTypes.GetDescriptorType(code);
         if (null == descriptorType)
         {
             writer.Write((string)(object)code + (object)":Unknown");
         }
         else
         {
             writer.Write((object)descriptorType);
         }
         if (length < (int)num)
         {
             writer.WriteLine(" " + (object)num + " exceeds buffer (" + (string)(object)length + " remaining)");
             break;
         }
         length -= (int)num;
         offset += (int)num;
     }
 }
 protected TsDescriptorFactoryInstanceBase(TsDescriptorType type)
 {
     if (null == type)
     {
         throw new ArgumentNullException("type");
     }
     this._type = type;
 }
 public static void Validate()
 {
     for (int index = 0; index < TsDescriptorTypes.DescriptorTypes.Length; ++index)
     {
         TsDescriptorType tsDescriptorType = TsDescriptorTypes.DescriptorTypes[index];
         if ((int)tsDescriptorType.Code != index)
         {
             throw new InvalidOperationException(string.Concat(new object[4]
             {
                 (object)"Descriptor type mismatch ",
                 (object)(int)tsDescriptorType.Code,
                 (object)" != ",
                 (object)index
             }));
         }
     }
 }