context: // Generated by ProtoGen, Version=2.3.0.277, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48.  DO NOT EDIT!
  #pragma warning disable 1591
  #region Designer generated code
  
  using pb = global::Google.ProtocolBuffers;
  using pbc = global::Google.ProtocolBuffers.Collections;
  using pbd = global::Google.ProtocolBuffers.Descriptors;
  using scg = global::System.Collections.Generic;
  namespace bnet.protocol.presence {
    
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
    public static partial class PresenceTypes {
    
      #region Extension registration
      public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
        registry.Add(global::bnet.protocol.presence.ChannelState.Presence);
      }
      #endregion
      #region Static variables
      internal static pbd::MessageDescriptor internal__static_bnet_protocol_presence_FieldKey__Descriptor;
      internal static pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.presence.FieldKey, global::bnet.protocol.presence.FieldKey.Builder> internal__static_bnet_protocol_presence_FieldKey__FieldAccessorTable;
      internal static pbd::MessageDescriptor internal__static_bnet_protocol_presence_Field__Descriptor;
      internal static pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.presence.Field, global::bnet.protocol.presence.Field.Builder> internal__static_bnet_protocol_presence_Field__FieldAccessorTable;
      internal static pbd::MessageDescriptor internal__static_bnet_protocol_presence_FieldOperation__Descriptor;
      internal static pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.presence.FieldOperation, global::bnet.protocol.presence.FieldOperation.Builder> internal__static_bnet_protocol_presence_FieldOperation__FieldAccessorTable;
      internal static pbd::MessageDescriptor internal__static_bnet_protocol_presence_ChannelState__Descriptor;
      internal static pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.presence.ChannelState, global::bnet.protocol.presence.ChannelState.Builder> internal__static_bnet_protocol_presence_ChannelState__FieldAccessorTable;
      #endregion
      #region Descriptor
      public static pbd::FileDescriptor Descriptor {
        get { return descriptor; }
      }
      private static pbd::FileDescriptor descriptor;
      
      static PresenceTypes() {
        byte[] descriptorData = global::System.Convert.FromBase64String(
            "CiVzZXJ2aWNlL3ByZXNlbmNlL3ByZXNlbmNlX3R5cGVzLnByb3RvEhZibmV0" + 
            "LnByb3RvY29sLnByZXNlbmNlGhxsaWIvcHJvdG9jb2wvYXR0cmlidXRlLnBy" + 
            "b3RvGhlsaWIvcHJvdG9jb2wvZW50aXR5LnByb3RvGiNzZXJ2aWNlL2NoYW5u" + 
            "ZWwvY2hhbm5lbF90eXBlcy5wcm90byJLCghGaWVsZEtleRIPCgdwcm9ncmFt" + 
            "GAEgAigNEg0KBWdyb3VwGAIgAigNEg0KBWZpZWxkGAMgAigNEhAKBWluZGV4" + 
            "GAQgASgEOgEwImcKBUZpZWxkEi0KA2tleRgBIAIoCzIgLmJuZXQucHJvdG9j" + 
            "b2wucHJlc2VuY2UuRmllbGRLZXkSLwoFdmFsdWUYAiACKAsyIC5ibmV0LnBy" + 
            "b3RvY29sLmF0dHJpYnV0ZS5WYXJpYW50IrEBCg5GaWVsZE9wZXJhdGlvbhIs" + 
            "CgVmaWVsZBgBIAIoCzIdLmJuZXQucHJvdG9jb2wucHJlc2VuY2UuRmllbGQS" + 
            "TAoJb3BlcmF0aW9uGAIgASgOMjQuYm5ldC5wcm90b2NvbC5wcmVzZW5jZS5G" + 
            "aWVsZE9wZXJhdGlvbi5PcGVyYXRpb25UeXBlOgNTRVQiIwoNT3BlcmF0aW9u" + 
            "VHlwZRIHCgNTRVQQABIJCgVDTEVBUhABItgBCgxDaGFubmVsU3RhdGUSKgoJ" + 
            "ZW50aXR5X2lkGAEgASgLMhcuYm5ldC5wcm90b2NvbC5FbnRpdHlJZBI/Cg9m" + 
            "aWVsZF9vcGVyYXRpb24YAiADKAsyJi5ibmV0LnByb3RvY29sLnByZXNlbmNl" + 
            "LkZpZWxkT3BlcmF0aW9uMlsKCHByZXNlbmNlEiMuYm5ldC5wcm90b2NvbC5j" + 
            "aGFubmVsLkNoYW5uZWxTdGF0ZRhlIAEoCzIkLmJuZXQucHJvdG9jb2wucHJl" + 
            "c2VuY2UuQ2hhbm5lbFN0YXRl");
        pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
          descriptor = root;
          internal__static_bnet_protocol_presence_FieldKey__Descriptor = Descriptor.MessageTypes[0];
          internal__static_bnet_protocol_presence_FieldKey__FieldAccessorTable = 
              new pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.presence.FieldKey, global::bnet.protocol.presence.FieldKey.Builder>(internal__static_bnet_protocol_presence_FieldKey__Descriptor,
                  new string[] { "Program", "Group", "Field", "Index", });
          internal__static_bnet_protocol_presence_Field__Descriptor = Descriptor.MessageTypes[1];
          internal__static_bnet_protocol_presence_Field__FieldAccessorTable = 
              new pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.presence.Field, global::bnet.protocol.presence.Field.Builder>(internal__static_bnet_protocol_presence_Field__Descriptor,
                  new string[] { "Key", "Value", });
          internal__static_bnet_protocol_presence_FieldOperation__Descriptor = Descriptor.MessageTypes[2];
          internal__static_bnet_protocol_presence_FieldOperation__FieldAccessorTable = 
              new pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.presence.FieldOperation, global::bnet.protocol.presence.FieldOperation.Builder>(internal__static_bnet_protocol_presence_FieldOperation__Descriptor,
                  new string[] { "Field", "Operation", });
          internal__static_bnet_protocol_presence_ChannelState__Descriptor = Descriptor.MessageTypes[3];
          internal__static_bnet_protocol_presence_ChannelState__FieldAccessorTable = 
              new pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.presence.ChannelState, global::bnet.protocol.presence.ChannelState.Builder>(internal__static_bnet_protocol_presence_ChannelState__Descriptor,
                  new string[] { "EntityId", "FieldOperation", });
          global::bnet.protocol.presence.ChannelState.Presence = pb::GeneratedSingleExtension<global::bnet.protocol.presence.ChannelState>.CreateInstance(global::bnet.protocol.presence.ChannelState.Descriptor.Extensions[0]);
          return null;
        };
        pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
            new pbd::FileDescriptor[] {
            global::bnet.protocol.attribute.Proto.Attribute.Descriptor, 
            global::bnet.protocol.Entity.Descriptor, 
            global::bnet.protocol.channel.ChannelTypes.Descriptor, 
            }, assigner);
      }
      #endregion
      
    }
    #region Messages
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
    public sealed partial class FieldKey : pb::GeneratedMessage<FieldKey, FieldKey.Builder> {
      private static readonly FieldKey defaultInstance = new Builder().BuildPartial();
      private static readonly string[] _fieldKeyFieldNames = new string[] { "field", "group", "index", "program" };
      private static readonly uint[] _fieldKeyFieldTags = new uint[] { 24, 16, 32, 8 };
      public static FieldKey DefaultInstance {
        get { return defaultInstance; }
      }
      
      public override FieldKey DefaultInstanceForType {
        get { return defaultInstance; }
      }
      
      protected override FieldKey ThisMessage {
        get { return this; }
      }
      
      public static pbd::MessageDescriptor Descriptor {
        get { return global::bnet.protocol.presence.PresenceTypes.internal__static_bnet_protocol_presence_FieldKey__Descriptor; }
      }
      
      protected override pb::FieldAccess.FieldAccessorTable<FieldKey, FieldKey.Builder> InternalFieldAccessors {
        get { return global::bnet.protocol.presence.PresenceTypes.internal__static_bnet_protocol_presence_FieldKey__FieldAccessorTable; }
      }
      
      public const int ProgramFieldNumber = 1;
      private bool hasProgram;
      private uint program_;
      public bool HasProgram {
        get { return hasProgram; }
      }
      public uint Program {
        get { return program_; }
      }
      
      public const int GroupFieldNumber = 2;
      private bool hasGroup;
      private uint group_;
      public bool HasGroup {
        get { return hasGroup; }
      }
      public uint Group {
        get { return group_; }
      }
      
      public const int FieldFieldNumber = 3;
      private bool hasField;
      private uint field_;
      public new bool HasField {
        get { return hasField; }
      }
      public uint Field {
        get { return field_; }
      }
      
      public const int IndexFieldNumber = 4;
      private bool hasIndex;
      private ulong index_;
      public bool HasIndex {
        get { return hasIndex; }
      }
      public ulong Index {
        get { return index_; }
      }
      
      public override bool IsInitialized {
        get {
          if (!hasProgram) return false;
          if (!hasGroup) return false;
          if (!hasField) return false;
          return true;
        }
      }
      
      public override void WriteTo(pb::ICodedOutputStream output) {
        int size = SerializedSize;
        string[] field_names = _fieldKeyFieldNames;
        if (hasProgram) {
          output.WriteUInt32(1, field_names[3], Program);
        }
        if (hasGroup) {
          output.WriteUInt32(2, field_names[1], Group);
        }
        if (hasField) {
          output.WriteUInt32(3, field_names[0], Field);
        }
        if (hasIndex) {
          output.WriteUInt64(4, field_names[2], Index);
        }
        UnknownFields.WriteTo(output);
      }
      
      private int memoizedSerializedSize = -1;
      public override int SerializedSize {
        get {
          int size = memoizedSerializedSize;
          if (size != -1) return size;
          
          size = 0;
          if (hasProgram) {
            size += pb::CodedOutputStream.ComputeUInt32Size(1, Program);
          }
          if (hasGroup) {
            size += pb::CodedOutputStream.ComputeUInt32Size(2, Group);
          }
          if (hasField) {
            size += pb::CodedOutputStream.ComputeUInt32Size(3, Field);
          }
          if (hasIndex) {
            size += pb::CodedOutputStream.ComputeUInt64Size(4, Index);
          }
          size += UnknownFields.SerializedSize;
          memoizedSerializedSize = size;
          return size;
        }
      }
      
      public static FieldKey ParseFrom(pb::ByteString data) {
        return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
      }
      public static FieldKey ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
      }
      public static FieldKey ParseFrom(byte[] data) {
        return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
      }
      public static FieldKey ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
      }
      public static FieldKey ParseFrom(global::System.IO.Stream input) {
        return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
      }
      public static FieldKey ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
      }
      public static FieldKey ParseDelimitedFrom(global::System.IO.Stream input) {
        return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
      }
      public static FieldKey ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
        return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
      }
      public static FieldKey ParseFrom(pb::ICodedInputStream input) {
        return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
      }
      public static FieldKey ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
      }
      public static Builder CreateBuilder() { return new Builder(); }
      public override Builder ToBuilder() { return CreateBuilder(this); }
      public override Builder CreateBuilderForType() { return new Builder(); }
      public static Builder CreateBuilder(FieldKey prototype) {
        return (Builder) new Builder().MergeFrom(prototype);
      }
      
      [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
      [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
      [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
      public sealed partial class Builder : pb::GeneratedBuilder<FieldKey, Builder> {
        protected override Builder ThisBuilder {
          get { return this; }
        }
        public Builder() {}
        
        FieldKey result = new FieldKey();
        
        protected override FieldKey MessageBeingBuilt {
          get { return result; }
        }
        
        public override Builder Clear() {
          result = new FieldKey();
          return this;
        }
        
        public override Builder Clone() {
          return new Builder().MergeFrom(result);
        }
        
        public override pbd::MessageDescriptor DescriptorForType {
          get { return global::bnet.protocol.presence.FieldKey.Descriptor; }
        }
        
        public override FieldKey DefaultInstanceForType {
          get { return global::bnet.protocol.presence.FieldKey.DefaultInstance; }
        }
        
        public override FieldKey BuildPartial() {
          if (result == null) {
            throw new global::System.InvalidOperationException("build() has already been called on this Builder");
          }
          FieldKey returnMe = result;
          result = null;
          return returnMe;
        }
        
        public override Builder MergeFrom(pb::IMessage other) {
          if (other is FieldKey) {
            return MergeFrom((FieldKey) other);
          } else {
            base.MergeFrom(other);
            return this;
          }
        }
        
        public override Builder MergeFrom(FieldKey other) {
          if (other == global::bnet.protocol.presence.FieldKey.DefaultInstance) return this;
          if (other.HasProgram) {
            Program = other.Program;
          }
          if (other.HasGroup) {
            Group = other.Group;
          }
          if (other.HasField) {
            Field = other.Field;
          }
          if (other.HasIndex) {
            Index = other.Index;
          }
          this.MergeUnknownFields(other.UnknownFields);
          return this;
        }
        
        public override Builder MergeFrom(pb::ICodedInputStream input) {
          return MergeFrom(input, pb::ExtensionRegistry.Empty);
        }
        
        public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
          pb::UnknownFieldSet.Builder unknownFields = null;
          uint tag;
          string field_name;
          while (input.ReadTag(out tag, out field_name)) {
            if(tag == 0 && field_name != null) {
              int field_ordinal = global::System.Array.BinarySearch(_fieldKeyFieldNames, field_name, global::System.StringComparer.Ordinal);
              if(field_ordinal >= 0)
                tag = _fieldKeyFieldTags[field_ordinal];
              else {
                if (unknownFields == null) {
                  unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
                }
                ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
                continue;
              }
            }
            switch (tag) {
              case 0: {
                throw pb::InvalidProtocolBufferException.InvalidTag();
              }
              default: {
                if (pb::WireFormat.IsEndGroupTag(tag)) {
                  if (unknownFields != null) {
                    this.UnknownFields = unknownFields.Build();
                  }
                  return this;
                }
                if (unknownFields == null) {
                  unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
                }
                ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
                break;
              }
              case 8: {
                result.hasProgram = input.ReadUInt32(ref result.program_);
                break;
              }
              case 16: {
                result.hasGroup = input.ReadUInt32(ref result.group_);
                break;
              }
              case 24: {
                result.hasField = input.ReadUInt32(ref result.field_);
                break;
              }
              case 32: {
                result.hasIndex = input.ReadUInt64(ref result.index_);
                break;
              }
            }
          }
          
          if (unknownFields != null) {
            this.UnknownFields = unknownFields.Build();
          }
          return this;
        }
        
        
        public bool HasProgram {
          get { return result.hasProgram; }
        }
        public uint Program {
          get { return result.Program; }
          set { SetProgram(value); }
        }
        public Builder SetProgram(uint value) {
          result.hasProgram = true;
          result.program_ = value;
          return this;
        }
        public Builder ClearProgram() {
          result.hasProgram = false;
          result.program_ = 0;
          return this;
        }
        
        public bool HasGroup {
          get { return result.hasGroup; }
        }
        public uint Group {
          get { return result.Group; }
          set { SetGroup(value); }
        }
        public Builder SetGroup(uint value) {
          result.hasGroup = true;
          result.group_ = value;
          return this;
        }
        public Builder ClearGroup() {
          result.hasGroup = false;
          result.group_ = 0;
          return this;
        }
        
        public new bool HasField {
          get { return result.hasField; }
        }
        public uint Field {
          get { return result.Field; }
          set { SetField(value); }
        }
        public Builder SetField(uint value) {
          result.hasField = true;
          result.field_ = value;
          return this;
        }
        public Builder ClearField() {
          result.hasField = false;
          result.field_ = 0;
          return this;
        }
        
        public bool HasIndex {
          get { return result.hasIndex; }
        }
        public ulong Index {
          get { return result.Index; }
          set { SetIndex(value); }
        }
        public Builder SetIndex(ulong value) {
          result.hasIndex = true;
          result.index_ = value;
          return this;
        }
        public Builder ClearIndex() {
          result.hasIndex = false;
          result.index_ = 0UL;
          return this;
        }
      }
      static FieldKey() {
        object.ReferenceEquals(global::bnet.protocol.presence.PresenceTypes.Descriptor, null);
      }
    }
    
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
    public sealed partial class Field : pb::GeneratedMessage<Field, Field.Builder> {
      private static readonly Field defaultInstance = new Builder().BuildPartial();
      private static readonly string[] _fieldFieldNames = new string[] { "key", "value" };
      private static readonly uint[] _fieldFieldTags = new uint[] { 10, 18 };
      public static Field DefaultInstance {
        get { return defaultInstance; }
      }
      
      public override Field DefaultInstanceForType {
        get { return defaultInstance; }
      }
      
      protected override Field ThisMessage {
        get { return this; }
      }
      
      public static pbd::MessageDescriptor Descriptor {
        get { return global::bnet.protocol.presence.PresenceTypes.internal__static_bnet_protocol_presence_Field__Descriptor; }
      }
      
      protected override pb::FieldAccess.FieldAccessorTable<Field, Field.Builder> InternalFieldAccessors {
        get { return global::bnet.protocol.presence.PresenceTypes.internal__static_bnet_protocol_presence_Field__FieldAccessorTable; }
      }
      
      public const int KeyFieldNumber = 1;
      private bool hasKey;
      private global::bnet.protocol.presence.FieldKey key_ = global::bnet.protocol.presence.FieldKey.DefaultInstance;
      public bool HasKey {
        get { return hasKey; }
      }
      public global::bnet.protocol.presence.FieldKey Key {
        get { return key_; }
      }
      
      public const int ValueFieldNumber = 2;
      private bool hasValue;
      private global::bnet.protocol.attribute.Variant value_ = global::bnet.protocol.attribute.Variant.DefaultInstance;
      public bool HasValue {
        get { return hasValue; }
      }
      public global::bnet.protocol.attribute.Variant Value {
        get { return value_; }
      }
      
      public override bool IsInitialized {
        get {
          if (!hasKey) return false;
          if (!hasValue) return false;
          if (!Key.IsInitialized) return false;
          return true;
        }
      }
      
      public override void WriteTo(pb::ICodedOutputStream output) {
        int size = SerializedSize;
        string[] field_names = _fieldFieldNames;
        if (hasKey) {
          output.WriteMessage(1, field_names[0], Key);
        }
        if (hasValue) {
          output.WriteMessage(2, field_names[1], Value);
        }
        UnknownFields.WriteTo(output);
      }
      
      private int memoizedSerializedSize = -1;
      public override int SerializedSize {
        get {
          int size = memoizedSerializedSize;
          if (size != -1) return size;
          
          size = 0;
          if (hasKey) {
            size += pb::CodedOutputStream.ComputeMessageSize(1, Key);
          }
          if (hasValue) {
            size += pb::CodedOutputStream.ComputeMessageSize(2, Value);
          }
          size += UnknownFields.SerializedSize;
          memoizedSerializedSize = size;
          return size;
        }
      }
      
      public static Field ParseFrom(pb::ByteString data) {
        return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
      }
      public static Field ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
      }
      public static Field ParseFrom(byte[] data) {
        return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
      }
      public static Field ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
      }
      public static Field ParseFrom(global::System.IO.Stream input) {
        return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
      }
      public static Field ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
      }
      public static Field ParseDelimitedFrom(global::System.IO.Stream input) {
        return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
      }
      public static Field ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
        return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
      }
      public static Field ParseFrom(pb::ICodedInputStream input) {
        return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
      }
      public static Field ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
      }
      public static Builder CreateBuilder() { return new Builder(); }
      public override Builder ToBuilder() { return CreateBuilder(this); }
      public override Builder CreateBuilderForType() { return new Builder(); }
      public static Builder CreateBuilder(Field prototype) {
        return (Builder) new Builder().MergeFrom(prototype);
      }
      
      [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
      [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
      [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
      public sealed partial class Builder : pb::GeneratedBuilder<Field, Builder> {
        protected override Builder ThisBuilder {
          get { return this; }
        }
        public Builder() {}
        
        Field result = new Field();
        
        protected override Field MessageBeingBuilt {
          get { return result; }
        }
        
        public override Builder Clear() {
          result = new Field();
          return this;
        }
        
        public override Builder Clone() {
          return new Builder().MergeFrom(result);
        }
        
        public override pbd::MessageDescriptor DescriptorForType {
          get { return global::bnet.protocol.presence.Field.Descriptor; }
        }
        
        public override Field DefaultInstanceForType {
          get { return global::bnet.protocol.presence.Field.DefaultInstance; }
        }
        
        public override Field BuildPartial() {
          if (result == null) {
            throw new global::System.InvalidOperationException("build() has already been called on this Builder");
          }
          Field returnMe = result;
          result = null;
          return returnMe;
        }
        
        public override Builder MergeFrom(pb::IMessage other) {
          if (other is Field) {
            return MergeFrom((Field) other);
          } else {
            base.MergeFrom(other);
            return this;
          }
        }
        
        public override Builder MergeFrom(Field other) {
          if (other == global::bnet.protocol.presence.Field.DefaultInstance) return this;
          if (other.HasKey) {
            MergeKey(other.Key);
          }
          if (other.HasValue) {
            MergeValue(other.Value);
          }
          this.MergeUnknownFields(other.UnknownFields);
          return this;
        }
        
        public override Builder MergeFrom(pb::ICodedInputStream input) {
          return MergeFrom(input, pb::ExtensionRegistry.Empty);
        }
        
        public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
          pb::UnknownFieldSet.Builder unknownFields = null;
          uint tag;
          string field_name;
          while (input.ReadTag(out tag, out field_name)) {
            if(tag == 0 && field_name != null) {
              int field_ordinal = global::System.Array.BinarySearch(_fieldFieldNames, field_name, global::System.StringComparer.Ordinal);
              if(field_ordinal >= 0)
                tag = _fieldFieldTags[field_ordinal];
              else {
                if (unknownFields == null) {
                  unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
                }
                ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
                continue;
              }
            }
            switch (tag) {
              case 0: {
                throw pb::InvalidProtocolBufferException.InvalidTag();
              }
              default: {
                if (pb::WireFormat.IsEndGroupTag(tag)) {
                  if (unknownFields != null) {
                    this.UnknownFields = unknownFields.Build();
                  }
                  return this;
                }
                if (unknownFields == null) {
                  unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
                }
                ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name);
                break;
              }
              case 10: {
                global::bnet.protocol.presence.FieldKey.Builder subBuilder = global::bnet.protocol.presence.FieldKey.CreateBuilder();
                if (result.hasKey) {
                  subBuilder.MergeFrom(Key);
                }
                input.ReadMessage(subBuilder, extensionRegistry);
                Key = subBuilder.BuildPartial();
                break;
              }
              case 18: {
                global::bnet.protocol.attribute.Variant.Builder subBuilder = global::bnet.protocol.attribute.Variant.CreateBuilder();
                if (result.hasValue) {
                  subBuilder.MergeFrom(Value);
                }
                input.ReadMessage(subBuilder, extensionRegistry);
                Value = subBuilder.BuildPartial();
                break;
              }
            }
          }
          
          if (unknownFields != null) {
            this.UnknownFields = unknownFields.Build();
          }
          return this;
        }
        
        
        public bool HasKey {
         get { return result.hasKey; }
        }
        public global::bnet.protocol.presence.FieldKey Key {
          get { return result.Key; }
          set { SetKey(value); }
        }
        public Builder SetKey(global::bnet.protocol.presence.FieldKey value) {
          pb::ThrowHelper.ThrowIfNull(value, "value");
          result.hasKey = true;
          result.key_ = value;
          return this;
        }
        public Builder SetKey(global::bnet.protocol.presence.FieldKey.Builder builderForValue) {
          pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
          result.hasKey = true;
          result.key_ = builderForValue.Build();
          return this;
        }
        public Builder MergeKey(global::bnet.protocol.presence.FieldKey value) {
          pb::ThrowHelper.ThrowIfNull(value, "value");
          if (result.hasKey &&
              result.key_ != global::bnet.protocol.presence.FieldKey.DefaultInstance) {
              result.key_ = global::bnet.protocol.presence.FieldKey.CreateBuilder(result.key_).MergeFrom(value).BuildPartial();
          } else {
            result.key_ = value;
          }
          result.hasKey = true;
          return this;
        }
        public Builder ClearKey() {
          result.hasKey = false;
          result.key_ = global::bnet.protocol.presence.FieldKey.DefaultInstance;
          return this;
        }
        
        public bool HasValue {
         get { return result.hasValue; }
        }
        public global::bnet.protocol.attribute.Variant Value {
          get { return result.Value; }
          set { SetValue(value); }
        }
        public Builder SetValue(global::bnet.protocol.attribute.Variant value) {
          pb::ThrowHelper.ThrowIfNull(value, "value");
          result.hasValue = true;
          result.value_ = value;
          return this;
        }
        public Builder SetValue(global::bnet.protocol.attribute.Variant.Builder builderForValue) {
          pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
          result.hasValue = true;
          result.value_ = builderForValue.Build();
          return this;
        }
        public Builder MergeValue(global::bnet.protocol.attribute.Variant value) {
          pb::ThrowHelper.ThrowIfNull(value, "value");
          if (result.hasValue &&
              result.value_ != global::bnet.protocol.attribute.Variant.DefaultInstance) {
              result.value_ = global::bnet.protocol.attribute.Variant.CreateBuilder(result.value_).MergeFrom(value).BuildPartial();
          } else {
            result.value_ = value;
          }
          result.hasValue = true;
          return this;
        }
        public Builder ClearValue() {
          result.hasValue = false;
          result.value_ = global::bnet.protocol.attribute.Variant.DefaultInstance;
          return this;
        }
      }
      static Field() {
        object.ReferenceEquals(global::bnet.protocol.presence.PresenceTypes.Descriptor, null);
      }
    }
    
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
    public sealed partial class FieldOperation : pb::GeneratedMessage<FieldOperation, FieldOperation.Builder> {
      private static readonly FieldOperation defaultInstance = new Builder().BuildPartial();
      private static readonly string[] _fieldOperationFieldNames = new string[] { "field", "operation" };
      private static readonly uint[] _fieldOperationFieldTags = new uint[] { 10, 16 };
      public static FieldOperation DefaultInstance {
        get { return defaultInstance; }
      }
      
      public override FieldOperation DefaultInstanceForType {
        get { return defaultInstance; }
      }
      
      protected override FieldOperation ThisMessage {
        get { return this; }
      }
      
      public static pbd::MessageDescriptor Descriptor {
        get { return global::bnet.protocol.presence.PresenceTypes.internal__static_bnet_protocol_presence_FieldOperation__Descriptor; }
      }
      
      protected override pb::FieldAccess.FieldAccessorTable<FieldOperation, FieldOperation.Builder> InternalFieldAccessors {
        get { return global::bnet.protocol.presence.PresenceTypes.internal__static_bnet_protocol_presence_FieldOperation__FieldAccessorTable; }
      }
      
      #region Nested types
      [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
      [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
      [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
      public static class Types {
        [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
        public enum OperationType {
          SET = 0,
          CLEAR = 1,
        }
        
      }
      #endregion
      
      public const int FieldFieldNumber = 1;
      private bool hasField;
      private global::bnet.protocol.presence.Field field_ = global::bnet.protocol.presence.Field.DefaultInstance;
      public new bool HasField {
        get { return hasField; }
      }
      public global::bnet.protocol.presence.Field Field {
        get { return field_; }
      }
      
      public const int OperationFieldNumber = 2;
      private bool hasOperation;
      private global::bnet.protocol.presence.FieldOperation.Types.OperationType operation_ = global::bnet.protocol.presence.FieldOperation.Types.OperationType.SET;
      public bool HasOperation {
        get { return hasOperation; }
      }
      public global::bnet.protocol.presence.FieldOperation.Types.OperationType Operation {
        get { return operation_; }
      }
      
      public override bool IsInitialized {
        get {
          if (!hasField) return false;
          if (!Field.IsInitialized) return false;
          return true;
        }
      }
      
      public override void WriteTo(pb::ICodedOutputStream output) {
        int size = SerializedSize;
        string[] field_names = _fieldOperationFieldNames;
        if (hasField) {
          output.WriteMessage(1, field_names[0], Field);
        }
        if (hasOperation) {
          output.WriteEnum(2, field_names[1], (int) Operation, Operation);
        }
        UnknownFields.WriteTo(output);
      }
      
      private int memoizedSerializedSize = -1;
      public override int SerializedSize {
        get {
          int size = memoizedSerializedSize;
          if (size != -1) return size;
          
          size = 0;
          if (hasField) {
            size += pb::CodedOutputStream.ComputeMessageSize(1, Field);
          }
          if (hasOperation) {
            size += pb::CodedOutputStream.ComputeEnumSize(2, (int) Operation);
          }
          size += UnknownFields.SerializedSize;
          memoizedSerializedSize = size;
          return size;
        }
      }
      
      public static FieldOperation ParseFrom(pb::ByteString data) {
        return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
      }
      public static FieldOperation ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
      }
      public static FieldOperation ParseFrom(byte[] data) {
        return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
      }
      public static FieldOperation ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
      }
      public static FieldOperation ParseFrom(global::System.IO.Stream input) {
        return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
      }
      public static FieldOperation ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
      }
      public static FieldOperation ParseDelimitedFrom(global::System.IO.Stream input) {
        return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
      }
      public static FieldOperation ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
        return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
      }
      public static FieldOperation ParseFrom(pb::ICodedInputStream input) {
        return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
      }
      public static FieldOperation ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
        return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
      }
      public static Builder CreateBuilder() { return new Builder(); }
      public override Builder ToBuilder() { return CreateBuilder(this); }
      public override Builder CreateBuilderForType() { return new Builder(); }
      public static Builder CreateBuilder(FieldOperation prototype) {
        return (Builder) new Builder().MergeFrom(prototype);
      }
      
      [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
      [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
      [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.3.0.277")]
      public sealed partial class Builder : pb::GeneratedBuilder<FieldOperation, Builder> {
        protected override Builder ThisBuilder {
          get { return this; }
        }
        public Builder() {}
        
        FieldOperation result = new FieldOperation();
        
        protected override FieldOperation MessageBeingBuilt {
          get { return result; }
        }
        
        public override Builder Clear() {
          result = new FieldOperation();
          return this;
        }
        
        public override Builder Clone() {
          return new Builder().MergeFrom(result);
        }
        
        public override pbd::MessageDescriptor DescriptorForType {
          get { return global::bnet.protocol.presence.FieldOperation.Descriptor; }
        }
        
        public override FieldOperation DefaultInstanceForType {
          get { return global::bnet.protocol.presence.FieldOperation.DefaultInstance; }
        }
        
        public override FieldOperation BuildPartial() {
          if (result == null) {
            throw new global::System.InvalidOperationException("build() has already been called on this Builder");
          }
          FieldOperation returnMe = result;
          result = null;
          return returnMe;
        }
        
        public override Builder MergeFrom(pb::IMessage other) {
          if (other is FieldOperation) {
            return MergeFrom((FieldOperation) other);
          } else {
            base.MergeFrom(other);
            return this;
          }
        }
        
        public override Builder MergeFrom(FieldOperation other) {
          if (other == global::bnet.protocol.presence.FieldOperation.DefaultInstance) return this;
          if (other.HasField) {
            MergeField(other.Field);
          }
          if (other.HasOperation) {
            Operation = other.Operation;
          }
          this.MergeUnknownFields(other.UnknownFields);
          return this;
        }
        
        public override Builder MergeFrom(pb::ICodedInputStream input) {
          return MergeFrom(input, pb::ExtensionRegistry.Empty);
        }
        
        public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
          pb::UnknownFieldSet.Builder unknownFields = null;
          uint tag;
          string field_name;
          while (input.ReadTag(out tag, out field_name)) {
            if(tag == 0 && field_name != null) {
              int field_ordinal = global::System.Array.BinarySearch(_fieldOperationFieldNames, field_name, global::System.StringComparer.Ordinal);
              if(field_ordinal >= 0)
                tag = _fieldOperationFieldTags[field_ordinal];
              else {
  
gt:               if (unknownFields == null) {