// Generated by ProtoGen, Version=2.4.1.473, Culture=neutral, PublicKeyToken=55f7125234beb589.  DO NOT EDIT!
#pragma warning disable 1591, 0612
#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 {
  
  namespace Proto {
    
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.4.1.473")]
    public static partial class RoleSet {
    
      #region Extension registration
      public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
      }
      #endregion
      #region Static variables
      internal static pbd::MessageDescriptor internal__static_bnet_protocol_Privilege__Descriptor;
      internal static pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.Privilege, global::bnet.protocol.Privilege.Builder> internal__static_bnet_protocol_Privilege__FieldAccessorTable;
      internal static pbd::MessageDescriptor internal__static_bnet_protocol_RoleSetConfig__Descriptor;
      internal static pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.RoleSetConfig, global::bnet.protocol.RoleSetConfig.Builder> internal__static_bnet_protocol_RoleSetConfig__FieldAccessorTable;
      internal static pbd::MessageDescriptor internal__static_bnet_protocol_Role__Descriptor;
      internal static pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.Role, global::bnet.protocol.Role.Builder> internal__static_bnet_protocol_Role__FieldAccessorTable;
      internal static pbd::MessageDescriptor internal__static_bnet_protocol_RoleSet__Descriptor;
      internal static pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.RoleSet, global::bnet.protocol.RoleSet.Builder> internal__static_bnet_protocol_RoleSet__FieldAccessorTable;
      #endregion
      #region Descriptor
      public static pbd::FileDescriptor Descriptor {
        get { return descriptor; }
      }
      private static pbd::FileDescriptor descriptor;
      
      static RoleSet() {
        byte[] descriptorData = global::System.Convert.FromBase64String(
            "ChNibmV0L3JvbGVfc2V0LnByb3RvEg1ibmV0LnByb3RvY29sGhRibmV0L2F0" + 
            "dHJpYnV0ZS5wcm90byIoCglQcml2aWxlZ2USDAoEbmFtZRgBIAIoCRINCgV2" + 
            "YWx1ZRgCIAIoDSJmCg1Sb2xlU2V0Q29uZmlnEisKCXByaXZpbGVnZRgBIAMo" + 
            "CzIYLmJuZXQucHJvdG9jb2wuUHJpdmlsZWdlEigKCHJvbGVfc2V0GAIgAigL" + 
            "MhYuYm5ldC5wcm90b2NvbC5Sb2xlU2V0ItABCgRSb2xlEgoKAmlkGAEgAigN" + 
            "EgwKBG5hbWUYAiACKAkSEQoJcHJpdmlsZWdlGAMgAygJEhsKD2Fzc2lnbmFi" + 
            "bGVfcm9sZRgEIAMoDUICEAESFwoIcmVxdWlyZWQYBSABKAg6BWZhbHNlEhUK" + 
            "BnVuaXF1ZRgGIAEoCDoFZmFsc2USFwoPcmVsZWdhdGlvbl9yb2xlGAcgASgN" + 
            "EjUKCWF0dHJpYnV0ZRgIIAMoCzIiLmJuZXQucHJvdG9jb2wuYXR0cmlidXRl" + 
            "LkF0dHJpYnV0ZSLOAQoHUm9sZVNldBIPCgdwcm9ncmFtGAEgAigJEg8KB3Nl" + 
            "cnZpY2UYAiACKAkSGAoHc3VidHlwZRgDIAEoCToHZGVmYXVsdBIhCgRyb2xl" + 
            "GAQgAygLMhMuYm5ldC5wcm90b2NvbC5Sb2xlEhgKDGRlZmF1bHRfcm9sZRgF" + 
            "IAMoDUICEAESEwoLbWF4X21lbWJlcnMYBiABKAUSNQoJYXR0cmlidXRlGAcg" + 
            "AygLMiIuYm5ldC5wcm90b2NvbC5hdHRyaWJ1dGUuQXR0cmlidXRl");
        pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
          descriptor = root;
          internal__static_bnet_protocol_Privilege__Descriptor = Descriptor.MessageTypes[0];
          internal__static_bnet_protocol_Privilege__FieldAccessorTable = 
              new pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.Privilege, global::bnet.protocol.Privilege.Builder>(internal__static_bnet_protocol_Privilege__Descriptor,
                  new string[] { "Name", "Value", });
          internal__static_bnet_protocol_RoleSetConfig__Descriptor = Descriptor.MessageTypes[1];
          internal__static_bnet_protocol_RoleSetConfig__FieldAccessorTable = 
              new pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.RoleSetConfig, global::bnet.protocol.RoleSetConfig.Builder>(internal__static_bnet_protocol_RoleSetConfig__Descriptor,
                  new string[] { "Privilege", "RoleSet", });
          internal__static_bnet_protocol_Role__Descriptor = Descriptor.MessageTypes[2];
          internal__static_bnet_protocol_Role__FieldAccessorTable = 
              new pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.Role, global::bnet.protocol.Role.Builder>(internal__static_bnet_protocol_Role__Descriptor,
                  new string[] { "Id", "Name", "Privilege", "AssignableRole", "Required", "Unique", "RelegationRole", "Attribute", });
          internal__static_bnet_protocol_RoleSet__Descriptor = Descriptor.MessageTypes[3];
          internal__static_bnet_protocol_RoleSet__FieldAccessorTable = 
              new pb::FieldAccess.FieldAccessorTable<global::bnet.protocol.RoleSet, global::bnet.protocol.RoleSet.Builder>(internal__static_bnet_protocol_RoleSet__Descriptor,
                  new string[] { "Program", "Service", "Subtype", "Role", "DefaultRole", "MaxMembers", "Attribute", });
          return null;
        };
        pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
            new pbd::FileDescriptor[] {
            global::bnet.protocol.attribute.Proto.Attribute.Descriptor, 
            }, assigner);
      }
      #endregion
      
    }
  }
  #region Messages
  [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
  [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
  [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.4.1.473")]
  public sealed partial class Privilege : pb::GeneratedMessage<Privilege, Privilege.Builder> {
    private Privilege() { }
    private static readonly Privilege defaultInstance = new Privilege().MakeReadOnly();
    private static readonly string[] _privilegeFieldNames = new string[] { "name", "value" };
    private static readonly uint[] _privilegeFieldTags = new uint[] { 10, 16 };
    public static Privilege DefaultInstance {
      get { return defaultInstance; }
    }
    
    public override Privilege DefaultInstanceForType {
      get { return DefaultInstance; }
    }
    
    protected override Privilege ThisMessage {
      get { return this; }
    }
    
    public static pbd::MessageDescriptor Descriptor {
      get { return global::bnet.protocol.Proto.RoleSet.internal__static_bnet_protocol_Privilege__Descriptor; }
    }
    
    protected override pb::FieldAccess.FieldAccessorTable<Privilege, Privilege.Builder> InternalFieldAccessors {
      get { return global::bnet.protocol.Proto.RoleSet.internal__static_bnet_protocol_Privilege__FieldAccessorTable; }
    }
    
    public const int NameFieldNumber = 1;
    private bool hasName;
    private string name_ = "";
    public bool HasName {
      get { return hasName; }
    }
    public string Name {
      get { return name_; }
    }
    
    public const int ValueFieldNumber = 2;
    private bool hasValue;
    private uint value_;
    public bool HasValue {
      get { return hasValue; }
    }
    public uint Value {
      get { return value_; }
    }
    
    public override bool IsInitialized {
      get {
        if (!hasName) return false;
        if (!hasValue) return false;
        return true;
      }
    }
    
    public override void WriteTo(pb::ICodedOutputStream output) {
      int size = SerializedSize;
      string[] field_names = _privilegeFieldNames;
      if (hasName) {
        output.WriteString(1, field_names[0], Name);
      }
      if (hasValue) {
        output.WriteUInt32(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 (hasName) {
          size += pb::CodedOutputStream.ComputeStringSize(1, Name);
        }
        if (hasValue) {
          size += pb::CodedOutputStream.ComputeUInt32Size(2, Value);
        }
        size += UnknownFields.SerializedSize;
        memoizedSerializedSize = size;
        return size;
      }
    }
    
    public static Privilege ParseFrom(pb::ByteString data) {
      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
    }
    public static Privilege ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
    }
    public static Privilege ParseFrom(byte[] data) {
      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
    }
    public static Privilege ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
    }
    public static Privilege ParseFrom(global::System.IO.Stream input) {
      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
    }
    public static Privilege ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
    }
    public static Privilege ParseDelimitedFrom(global::System.IO.Stream input) {
      return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
    }
    public static Privilege ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
      return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
    }
    public static Privilege ParseFrom(pb::ICodedInputStream input) {
      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
    }
    public static Privilege ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
    }
    private Privilege MakeReadOnly() {
      return this;
    }
    
    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(Privilege prototype) {
      return new Builder(prototype);
    }
    
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.4.1.473")]
    public sealed partial class Builder : pb::GeneratedBuilder<Privilege, Builder> {
      protected override Builder ThisBuilder {
        get { return this; }
      }
      public Builder() {
        result = DefaultInstance;
        resultIsReadOnly = true;
      }
      internal Builder(Privilege cloneFrom) {
        result = cloneFrom;
        resultIsReadOnly = true;
      }
      
      private bool resultIsReadOnly;
      private Privilege result;
      
      private Privilege PrepareBuilder() {
        if (resultIsReadOnly) {
          Privilege original = result;
          result = new Privilege();
          resultIsReadOnly = false;
          MergeFrom(original);
        }
        return result;
      }
      
      public override bool IsInitialized {
        get { return result.IsInitialized; }
      }
      
      protected override Privilege MessageBeingBuilt {
        get { return PrepareBuilder(); }
      }
      
      public override Builder Clear() {
        result = DefaultInstance;
        resultIsReadOnly = true;
        return this;
      }
      
      public override Builder Clone() {
        if (resultIsReadOnly) {
          return new Builder(result);
        } else {
          return new Builder().MergeFrom(result);
        }
      }
      
      public override pbd::MessageDescriptor DescriptorForType {
        get { return global::bnet.protocol.Privilege.Descriptor; }
      }
      
      public override Privilege DefaultInstanceForType {
        get { return global::bnet.protocol.Privilege.DefaultInstance; }
      }
      
      public override Privilege BuildPartial() {
        if (resultIsReadOnly) {
          return result;
        }
        resultIsReadOnly = true;
        return result.MakeReadOnly();
      }
      
      public override Builder MergeFrom(pb::IMessage other) {
        if (other is Privilege) {
          return MergeFrom((Privilege) other);
        } else {
          base.MergeFrom(other);
          return this;
        }
      }
      
      public override Builder MergeFrom(Privilege other) {
        if (other == global::bnet.protocol.Privilege.DefaultInstance) return this;
        PrepareBuilder();
        if (other.HasName) {
          Name = other.Name;
        }
        if (other.HasValue) {
          Value = 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) {
        PrepareBuilder();
        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(_privilegeFieldNames, field_name, global::System.StringComparer.Ordinal);
            if(field_ordinal >= 0)
              tag = _privilegeFieldTags[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: {
              result.hasName = input.ReadString(ref result.name_);
              break;
            }
            case 16: {
              result.hasValue = input.ReadUInt32(ref result.value_);
              break;
            }
          }
        }
        
        if (unknownFields != null) {
          this.UnknownFields = unknownFields.Build();
        }
        return this;
      }
      
      
      public bool HasName {
        get { return result.hasName; }
      }
      public string Name {
        get { return result.Name; }
        set { SetName(value); }
      }
      public Builder SetName(string value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.hasName = true;
        result.name_ = value;
        return this;
      }
      public Builder ClearName() {
        PrepareBuilder();
        result.hasName = false;
        result.name_ = "";
        return this;
      }
      
      public bool HasValue {
        get { return result.hasValue; }
      }
      public uint Value {
        get { return result.Value; }
        set { SetValue(value); }
      }
      public Builder SetValue(uint value) {
        PrepareBuilder();
        result.hasValue = true;
        result.value_ = value;
        return this;
      }
      public Builder ClearValue() {
        PrepareBuilder();
        result.hasValue = false;
        result.value_ = 0;
        return this;
      }
    }
    static Privilege() {
      object.ReferenceEquals(global::bnet.protocol.Proto.RoleSet.Descriptor, null);
    }
  }
  
  [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
  [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
  [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.4.1.473")]
  public sealed partial class RoleSetConfig : pb::GeneratedMessage<RoleSetConfig, RoleSetConfig.Builder> {
    private RoleSetConfig() { }
    private static readonly RoleSetConfig defaultInstance = new RoleSetConfig().MakeReadOnly();
    private static readonly string[] _roleSetConfigFieldNames = new string[] { "privilege", "role_set" };
    private static readonly uint[] _roleSetConfigFieldTags = new uint[] { 10, 18 };
    public static RoleSetConfig DefaultInstance {
      get { return defaultInstance; }
    }
    
    public override RoleSetConfig DefaultInstanceForType {
      get { return DefaultInstance; }
    }
    
    protected override RoleSetConfig ThisMessage {
      get { return this; }
    }
    
    public static pbd::MessageDescriptor Descriptor {
      get { return global::bnet.protocol.Proto.RoleSet.internal__static_bnet_protocol_RoleSetConfig__Descriptor; }
    }
    
    protected override pb::FieldAccess.FieldAccessorTable<RoleSetConfig, RoleSetConfig.Builder> InternalFieldAccessors {
      get { return global::bnet.protocol.Proto.RoleSet.internal__static_bnet_protocol_RoleSetConfig__FieldAccessorTable; }
    }
    
    public const int PrivilegeFieldNumber = 1;
    private pbc::PopsicleList<global::bnet.protocol.Privilege> privilege_ = new pbc::PopsicleList<global::bnet.protocol.Privilege>();
    public scg::IList<global::bnet.protocol.Privilege> PrivilegeList {
      get { return privilege_; }
    }
    public int PrivilegeCount {
      get { return privilege_.Count; }
    }
    public global::bnet.protocol.Privilege GetPrivilege(int index) {
      return privilege_[index];
    }
    
    public const int RoleSetFieldNumber = 2;
    private bool hasRoleSet;
    private global::bnet.protocol.RoleSet roleSet_;
    public bool HasRoleSet {
      get { return hasRoleSet; }
    }
    public global::bnet.protocol.RoleSet RoleSet {
      get { return roleSet_ ?? global::bnet.protocol.RoleSet.DefaultInstance; }
    }
    
    public override bool IsInitialized {
      get {
        if (!hasRoleSet) return false;
        foreach (global::bnet.protocol.Privilege element in PrivilegeList) {
          if (!element.IsInitialized) return false;
        }
        if (!RoleSet.IsInitialized) return false;
        return true;
      }
    }
    
    public override void WriteTo(pb::ICodedOutputStream output) {
      int size = SerializedSize;
      string[] field_names = _roleSetConfigFieldNames;
      if (privilege_.Count > 0) {
        output.WriteMessageArray(1, field_names[0], privilege_);
      }
      if (hasRoleSet) {
        output.WriteMessage(2, field_names[1], RoleSet);
      }
      UnknownFields.WriteTo(output);
    }
    
    private int memoizedSerializedSize = -1;
    public override int SerializedSize {
      get {
        int size = memoizedSerializedSize;
        if (size != -1) return size;
        
        size = 0;
        foreach (global::bnet.protocol.Privilege element in PrivilegeList) {
          size += pb::CodedOutputStream.ComputeMessageSize(1, element);
        }
        if (hasRoleSet) {
          size += pb::CodedOutputStream.ComputeMessageSize(2, RoleSet);
        }
        size += UnknownFields.SerializedSize;
        memoizedSerializedSize = size;
        return size;
      }
    }
    
    public static RoleSetConfig ParseFrom(pb::ByteString data) {
      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
    }
    public static RoleSetConfig ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
    }
    public static RoleSetConfig ParseFrom(byte[] data) {
      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
    }
    public static RoleSetConfig ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
    }
    public static RoleSetConfig ParseFrom(global::System.IO.Stream input) {
      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
    }
    public static RoleSetConfig ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
    }
    public static RoleSetConfig ParseDelimitedFrom(global::System.IO.Stream input) {
      return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
    }
    public static RoleSetConfig ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
      return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
    }
    public static RoleSetConfig ParseFrom(pb::ICodedInputStream input) {
      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
    }
    public static RoleSetConfig ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
    }
    private RoleSetConfig MakeReadOnly() {
      privilege_.MakeReadOnly();
      return this;
    }
    
    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(RoleSetConfig prototype) {
      return new Builder(prototype);
    }
    
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.4.1.473")]
    public sealed partial class Builder : pb::GeneratedBuilder<RoleSetConfig, Builder> {
      protected override Builder ThisBuilder {
        get { return this; }
      }
      public Builder() {
        result = DefaultInstance;
        resultIsReadOnly = true;
      }
      internal Builder(RoleSetConfig cloneFrom) {
        result = cloneFrom;
        resultIsReadOnly = true;
      }
      
      private bool resultIsReadOnly;
      private RoleSetConfig result;
      
      private RoleSetConfig PrepareBuilder() {
        if (resultIsReadOnly) {
          RoleSetConfig original = result;
          result = new RoleSetConfig();
          resultIsReadOnly = false;
          MergeFrom(original);
        }
        return result;
      }
      
      public override bool IsInitialized {
        get { return result.IsInitialized; }
      }
      
      protected override RoleSetConfig MessageBeingBuilt {
        get { return PrepareBuilder(); }
      }
      
      public override Builder Clear() {
        result = DefaultInstance;
        resultIsReadOnly = true;
        return this;
      }
      
      public override Builder Clone() {
        if (resultIsReadOnly) {
          return new Builder(result);
        } else {
          return new Builder().MergeFrom(result);
        }
      }
      
      public override pbd::MessageDescriptor DescriptorForType {
        get { return global::bnet.protocol.RoleSetConfig.Descriptor; }
      }
      
      public override RoleSetConfig DefaultInstanceForType {
        get { return global::bnet.protocol.RoleSetConfig.DefaultInstance; }
      }
      
      public override RoleSetConfig BuildPartial() {
        if (resultIsReadOnly) {
          return result;
        }
        resultIsReadOnly = true;
        return result.MakeReadOnly();
      }
      
      public override Builder MergeFrom(pb::IMessage other) {
        if (other is RoleSetConfig) {
          return MergeFrom((RoleSetConfig) other);
        } else {
          base.MergeFrom(other);
          return this;
        }
      }
      
      public override Builder MergeFrom(RoleSetConfig other) {
        if (other == global::bnet.protocol.RoleSetConfig.DefaultInstance) return this;
        PrepareBuilder();
        if (other.privilege_.Count != 0) {
          result.privilege_.Add(other.privilege_);
        }
        if (other.HasRoleSet) {
          MergeRoleSet(other.RoleSet);
        }
        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) {
        PrepareBuilder();
        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(_roleSetConfigFieldNames, field_name, global::System.StringComparer.Ordinal);
            if(field_ordinal >= 0)
              tag = _roleSetConfigFieldTags[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: {
              input.ReadMessageArray(tag, field_name, result.privilege_, global::bnet.protocol.Privilege.DefaultInstance, extensionRegistry);
              break;
            }
            case 18: {
              global::bnet.protocol.RoleSet.Builder subBuilder = global::bnet.protocol.RoleSet.CreateBuilder();
              if (result.hasRoleSet) {
                subBuilder.MergeFrom(RoleSet);
              }
              input.ReadMessage(subBuilder, extensionRegistry);
              RoleSet = subBuilder.BuildPartial();
              break;
            }
          }
        }
        
        if (unknownFields != null) {
          this.UnknownFields = unknownFields.Build();
        }
        return this;
      }
      
      
      public pbc::IPopsicleList<global::bnet.protocol.Privilege> PrivilegeList {
        get { return PrepareBuilder().privilege_; }
      }
      public int PrivilegeCount {
        get { return result.PrivilegeCount; }
      }
      public global::bnet.protocol.Privilege GetPrivilege(int index) {
        return result.GetPrivilege(index);
      }
      public Builder SetPrivilege(int index, global::bnet.protocol.Privilege value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.privilege_[index] = value;
        return this;
      }
      public Builder SetPrivilege(int index, global::bnet.protocol.Privilege.Builder builderForValue) {
        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
        PrepareBuilder();
        result.privilege_[index] = builderForValue.Build();
        return this;
      }
      public Builder AddPrivilege(global::bnet.protocol.Privilege value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.privilege_.Add(value);
        return this;
      }
      public Builder AddPrivilege(global::bnet.protocol.Privilege.Builder builderForValue) {
        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
        PrepareBuilder();
        result.privilege_.Add(builderForValue.Build());
        return this;
      }
      public Builder AddRangePrivilege(scg::IEnumerable<global::bnet.protocol.Privilege> values) {
        PrepareBuilder();
        result.privilege_.Add(values);
        return this;
      }
      public Builder ClearPrivilege() {
        PrepareBuilder();
        result.privilege_.Clear();
        return this;
      }
      
      public bool HasRoleSet {
       get { return result.hasRoleSet; }
      }
      public global::bnet.protocol.RoleSet RoleSet {
        get { return result.RoleSet; }
        set { SetRoleSet(value); }
      }
      public Builder SetRoleSet(global::bnet.protocol.RoleSet value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.hasRoleSet = true;
        result.roleSet_ = value;
        return this;
      }
      public Builder SetRoleSet(global::bnet.protocol.RoleSet.Builder builderForValue) {
        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
        PrepareBuilder();
        result.hasRoleSet = true;
        result.roleSet_ = builderForValue.Build();
        return this;
      }
      public Builder MergeRoleSet(global::bnet.protocol.RoleSet value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        if (result.hasRoleSet &&
            result.roleSet_ != global::bnet.protocol.RoleSet.DefaultInstance) {
            result.roleSet_ = global::bnet.protocol.RoleSet.CreateBuilder(result.roleSet_).MergeFrom(value).BuildPartial();
        } else {
          result.roleSet_ = value;
        }
        result.hasRoleSet = true;
        return this;
      }
      public Builder ClearRoleSet() {
        PrepareBuilder();
        result.hasRoleSet = false;
        result.roleSet_ = null;
        return this;
      }
    }
    static RoleSetConfig() {
      object.ReferenceEquals(global::bnet.protocol.Proto.RoleSet.Descriptor, null);
    }
  }
  
  [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
  [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
  [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.4.1.473")]
  public sealed partial class Role : pb::GeneratedMessage<Role, Role.Builder> {
    private Role() { }
    private static readonly Role defaultInstance = new Role().MakeReadOnly();
    private static readonly string[] _roleFieldNames = new string[] { "assignable_role", "attribute", "id", "name", "privilege", "relegation_role", "required", "unique" };
    private static readonly uint[] _roleFieldTags = new uint[] { 34, 66, 8, 18, 26, 56, 40, 48 };
    public static Role DefaultInstance {
      get { return defaultInstance; }
    }
    
    public override Role DefaultInstanceForType {
      get { return DefaultInstance; }
    }
    
    protected override Role ThisMessage {
      get { return this; }
    }
    
    public static pbd::MessageDescriptor Descriptor {
      get { return global::bnet.protocol.Proto.RoleSet.internal__static_bnet_protocol_Role__Descriptor; }
    }
    
    protected override pb::FieldAccess.FieldAccessorTable<Role, Role.Builder> InternalFieldAccessors {
      get { return global::bnet.protocol.Proto.RoleSet.internal__static_bnet_protocol_Role__FieldAccessorTable; }
    }
    
    public const int IdFieldNumber = 1;
    private bool hasId;
    private uint id_;
    public bool HasId {
      get { return hasId; }
    }
    public uint Id {
      get { return id_; }
    }
    
    public const int NameFieldNumber = 2;
    private bool hasName;
    private string name_ = "";
    public bool HasName {
      get { return hasName; }
    }
    public string Name {
      get { return name_; }
    }
    
    public const int PrivilegeFieldNumber = 3;
    private pbc::PopsicleList<string> privilege_ = new pbc::PopsicleList<string>();
    public scg::IList<string> PrivilegeList {
      get { return pbc::Lists.AsReadOnly(privilege_); }
    }
    public int PrivilegeCount {
      get { return privilege_.Count; }
    }
    public string GetPrivilege(int index) {
      return privilege_[index];
    }
    
    public const int AssignableRoleFieldNumber = 4;
    private int assignableRoleMemoizedSerializedSize;
    private pbc::PopsicleList<uint> assignableRole_ = new pbc::PopsicleList<uint>();
    public scg::IList<uint> AssignableRoleList {
      get { return pbc::Lists.AsReadOnly(assignableRole_); }
    }
    public int AssignableRoleCount {
      get { return assignableRole_.Count; }
    }
    public uint GetAssignableRole(int index) {
      return assignableRole_[index];
    }
    
    public const int RequiredFieldNumber = 5;
    private bool hasRequired;
    private bool required_;
    public bool HasRequired {
      get { return hasRequired; }
    }
    public bool Required {
      get { return required_; }
    }
    
    public const int UniqueFieldNumber = 6;
    private bool hasUnique;
    private bool unique_;
    public bool HasUnique {
      get { return hasUnique; }
    }
    public bool Unique {
      get { return unique_; }
    }
    
    public const int RelegationRoleFieldNumber = 7;
    private bool hasRelegationRole;
    private uint relegationRole_;
    public bool HasRelegationRole {
      get { return hasRelegationRole; }
    }
    public uint RelegationRole {
      get { return relegationRole_; }
    }
    
    public const int AttributeFieldNumber = 8;
    private pbc::PopsicleList<global::bnet.protocol.attribute.Attribute> attribute_ = new pbc::PopsicleList<global::bnet.protocol.attribute.Attribute>();
    public scg::IList<global::bnet.protocol.attribute.Attribute> AttributeList {
      get { return attribute_; }
    }
    public int AttributeCount {
      get { return attribute_.Count; }
    }
    public global::bnet.protocol.attribute.Attribute GetAttribute(int index) {
      return attribute_[index];
    }
    
    public override bool IsInitialized {
      get {
        if (!hasId) return false;
        if (!hasName) return false;
        foreach (global::bnet.protocol.attribute.Attribute element in AttributeList) {
          if (!element.IsInitialized) return false;
        }
        return true;
      }
    }
    
    public override void WriteTo(pb::ICodedOutputStream output) {
      int size = SerializedSize;
      string[] field_names = _roleFieldNames;
      if (hasId) {
        output.WriteUInt32(1, field_names[2], Id);
      }
      if (hasName) {
        output.WriteString(2, field_names[3], Name);
      }
      if (privilege_.Count > 0) {
        output.WriteStringArray(3, field_names[4], privilege_);
      }
      if (assignableRole_.Count > 0) {
        output.WritePackedUInt32Array(4, field_names[0], assignableRoleMemoizedSerializedSize, assignableRole_);
      }
      if (hasRequired) {
        output.WriteBool(5, field_names[6], Required);
      }
      if (hasUnique) {
        output.WriteBool(6, field_names[7], Unique);
      }
      if (hasRelegationRole) {
        output.WriteUInt32(7, field_names[5], RelegationRole);
      }
      if (attribute_.Count > 0) {
        output.WriteMessageArray(8, field_names[1], attribute_);
      }
      UnknownFields.WriteTo(output);
    }
    
    private int memoizedSerializedSize = -1;
    public override int SerializedSize {
      get {
        int size = memoizedSerializedSize;
        if (size != -1) return size;
        
        size = 0;
        if (hasId) {
          size += pb::CodedOutputStream.ComputeUInt32Size(1, Id);
        }
        if (hasName) {
          size += pb::CodedOutputStream.ComputeStringSize(2, Name);
        }
        {
          int dataSize = 0;
          foreach (string element in PrivilegeList) {
            dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element);
          }
          size += dataSize;
          size += 1 * privilege_.Count;
        }
        {
          int dataSize = 0;
          foreach (uint element in AssignableRoleList) {
            dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element);
          }
          size += dataSize;
          if (assignableRole_.Count != 0) {
            size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);
          }
          assignableRoleMemoizedSerializedSize = dataSize;
        }
        if (hasRequired) {
          size += pb::CodedOutputStream.ComputeBoolSize(5, Required);
        }
        if (hasUnique) {
          size += pb::CodedOutputStream.ComputeBoolSize(6, Unique);
        }
        if (hasRelegationRole) {
          size += pb::CodedOutputStream.ComputeUInt32Size(7, RelegationRole);
        }
        foreach (global::bnet.protocol.attribute.Attribute element in AttributeList) {
          size += pb::CodedOutputStream.ComputeMessageSize(8, element);
        }
        size += UnknownFields.SerializedSize;
        memoizedSerializedSize = size;
        return size;
      }
    }
    
    public static Role ParseFrom(pb::ByteString data) {
      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
    }
    public static Role ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
    }
    public static Role ParseFrom(byte[] data) {
      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
    }
    public static Role ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
    }
    public static Role ParseFrom(global::System.IO.Stream input) {
      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
    }
    public static Role ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
    }
    public static Role ParseDelimitedFrom(global::System.IO.Stream input) {
      return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
    }
    public static Role ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
      return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
    }
    public static Role ParseFrom(pb::ICodedInputStream input) {
      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
    }
    public static Role ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
    }
    private Role MakeReadOnly() {
      privilege_.MakeReadOnly();
      assignableRole_.MakeReadOnly();
      attribute_.MakeReadOnly();
      return this;
    }
    
    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(Role prototype) {
      return new Builder(prototype);
    }
    
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.4.1.473")]
    public sealed partial class Builder : pb::GeneratedBuilder<Role, Builder> {
      protected override Builder ThisBuilder {
        get { return this; }
      }
      public Builder() {
        result = DefaultInstance;
        resultIsReadOnly = true;
      }
      internal Builder(Role cloneFrom) {
        result = cloneFrom;
        resultIsReadOnly = true;
      }
      
      private bool resultIsReadOnly;
      private Role result;
      
      private Role PrepareBuilder() {
        if (resultIsReadOnly) {
          Role original = result;
          result = new Role();
          resultIsReadOnly = false;
          MergeFrom(original);
        }
        return result;
      }
      
      public override bool IsInitialized {
        get { return result.IsInitialized; }
      }
      
      protected override Role MessageBeingBuilt {
        get { return PrepareBuilder(); }
      }
      
      public override Builder Clear() {
        result = DefaultInstance;
        resultIsReadOnly = true;
        return this;
      }
      
      public override Builder Clone() {
        if (resultIsReadOnly) {
          return new Builder(result);
        } else {
          return new Builder().MergeFrom(result);
        }
      }
      
      public override pbd::MessageDescriptor DescriptorForType {
        get { return global::bnet.protocol.Role.Descriptor; }
      }
      
      public override Role DefaultInstanceForType {
        get { return global::bnet.protocol.Role.DefaultInstance; }
      }
      
      public override Role BuildPartial() {
        if (resultIsReadOnly) {
          return result;
        }
        resultIsReadOnly = true;
        return result.MakeReadOnly();
      }
      
      public override Builder MergeFrom(pb::IMessage other) {
        if (other is Role) {
          return MergeFrom((Role) other);
        } else {
          base.MergeFrom(other);
          return this;
        }
      }
      
      public override Builder MergeFrom(Role other) {
        if (other == global::bnet.protocol.Role.DefaultInstance) return this;
        PrepareBuilder();
        if (other.HasId) {
          Id = other.Id;
        }
        if (other.HasName) {
          Name = other.Name;
        }
        if (other.privilege_.Count != 0) {
          result.privilege_.Add(other.privilege_);
        }
        if (other.assignableRole_.Count != 0) {
          result.assignableRole_.Add(other.assignableRole_);
        }
        if (other.HasRequired) {
          Required = other.Required;
        }
        if (other.HasUnique) {
          Unique = other.Unique;
        }
        if (other.HasRelegationRole) {
          RelegationRole = other.RelegationRole;
        }
        if (other.attribute_.Count != 0) {
          result.attribute_.Add(other.attribute_);
        }
        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) {
        PrepareBuilder();
        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(_roleFieldNames, field_name, global::System.StringComparer.Ordinal);
            if(field_ordinal >= 0)
              tag = _roleFieldTags[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.hasId = input.ReadUInt32(ref result.id_);
              break;
            }
            case 18: {
              result.hasName = input.ReadString(ref result.name_);
              break;
            }
            case 26: {
              input.ReadStringArray(tag, field_name, result.privilege_);
              break;
            }
            case 34:
            case 32: {
              input.ReadUInt32Array(tag, field_name, result.assignableRole_);
              break;
            }
            case 40: {
              result.hasRequired = input.ReadBool(ref result.required_);
              break;
            }
            case 48: {
              result.hasUnique = input.ReadBool(ref result.unique_);
              break;
            }
            case 56: {
              result.hasRelegationRole = input.ReadUInt32(ref result.relegationRole_);
              break;
            }
            case 66: {
              input.ReadMessageArray(tag, field_name, result.attribute_, global::bnet.protocol.attribute.Attribute.DefaultInstance, extensionRegistry);
              break;
            }
          }
        }
        
        if (unknownFields != null) {
          this.UnknownFields = unknownFields.Build();
        }
        return this;
      }
      
      
      public bool HasId {
        get { return result.hasId; }
      }
      public uint Id {
        get { return result.Id; }
        set { SetId(value); }
      }
      public Builder SetId(uint value) {
        PrepareBuilder();
        result.hasId = true;
        result.id_ = value;
        return this;
      }
      public Builder ClearId() {
        PrepareBuilder();
        result.hasId = false;
        result.id_ = 0;
        return this;
      }
      
      public bool HasName {
        get { return result.hasName; }
      }
      public string Name {
        get { return result.Name; }
        set { SetName(value); }
      }
      public Builder SetName(string value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.hasName = true;
        result.name_ = value;
        return this;
      }
      public Builder ClearName() {
        PrepareBuilder();
        result.hasName = false;
        result.name_ = "";
        return this;
      }
      
      public pbc::IPopsicleList<string> PrivilegeList {
        get { return PrepareBuilder().privilege_; }
      }
      public int PrivilegeCount {
        get { return result.PrivilegeCount; }
      }
      public string GetPrivilege(int index) {
        return result.GetPrivilege(index);
      }
      public Builder SetPrivilege(int index, string value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.privilege_[index] = value;
        return this;
      }
      public Builder AddPrivilege(string value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.privilege_.Add(value);
        return this;
      }
      public Builder AddRangePrivilege(scg::IEnumerable<string> values) {
        PrepareBuilder();
        result.privilege_.Add(values);
        return this;
      }
      public Builder ClearPrivilege() {
        PrepareBuilder();
        result.privilege_.Clear();
        return this;
      }
      
      public pbc::IPopsicleList<uint> AssignableRoleList {
        get { return PrepareBuilder().assignableRole_; }
      }
      public int AssignableRoleCount {
        get { return result.AssignableRoleCount; }
      }
      public uint GetAssignableRole(int index) {
        return result.GetAssignableRole(index);
      }
      public Builder SetAssignableRole(int index, uint value) {
        PrepareBuilder();
        result.assignableRole_[index] = value;
        return this;
      }
      public Builder AddAssignableRole(uint value) {
        PrepareBuilder();
        result.assignableRole_.Add(value);
        return this;
      }
      public Builder AddRangeAssignableRole(scg::IEnumerable<uint> values) {
        PrepareBuilder();
        result.assignableRole_.Add(values);
        return this;
      }
      public Builder ClearAssignableRole() {
        PrepareBuilder();
        result.assignableRole_.Clear();
        return this;
      }
      
      public bool HasRequired {
        get { return result.hasRequired; }
      }
      public bool Required {
        get { return result.Required; }
        set { SetRequired(value); }
      }
      public Builder SetRequired(bool value) {
        PrepareBuilder();
        result.hasRequired = true;
        result.required_ = value;
        return this;
      }
      public Builder ClearRequired() {
        PrepareBuilder();
        result.hasRequired = false;
        result.required_ = false;
        return this;
      }
      
      public bool HasUnique {
        get { return result.hasUnique; }
      }
      public bool Unique {
        get { return result.Unique; }
        set { SetUnique(value); }
      }
      public Builder SetUnique(bool value) {
        PrepareBuilder();
        result.hasUnique = true;
        result.unique_ = value;
        return this;
      }
      public Builder ClearUnique() {
        PrepareBuilder();
        result.hasUnique = false;
        result.unique_ = false;
        return this;
      }
      
      public bool HasRelegationRole {
        get { return result.hasRelegationRole; }
      }
      public uint RelegationRole {
        get { return result.RelegationRole; }
        set { SetRelegationRole(value); }
      }
      public Builder SetRelegationRole(uint value) {
        PrepareBuilder();
        result.hasRelegationRole = true;
        result.relegationRole_ = value;
        return this;
      }
      public Builder ClearRelegationRole() {
        PrepareBuilder();
        result.hasRelegationRole = false;
        result.relegationRole_ = 0;
        return this;
      }
      
      public pbc::IPopsicleList<global::bnet.protocol.attribute.Attribute> AttributeList {
        get { return PrepareBuilder().attribute_; }
      }
      public int AttributeCount {
        get { return result.AttributeCount; }
      }
      public global::bnet.protocol.attribute.Attribute GetAttribute(int index) {
        return result.GetAttribute(index);
      }
      public Builder SetAttribute(int index, global::bnet.protocol.attribute.Attribute value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.attribute_[index] = value;
        return this;
      }
      public Builder SetAttribute(int index, global::bnet.protocol.attribute.Attribute.Builder builderForValue) {
        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
        PrepareBuilder();
        result.attribute_[index] = builderForValue.Build();
        return this;
      }
      public Builder AddAttribute(global::bnet.protocol.attribute.Attribute value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.attribute_.Add(value);
        return this;
      }
      public Builder AddAttribute(global::bnet.protocol.attribute.Attribute.Builder builderForValue) {
        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
        PrepareBuilder();
        result.attribute_.Add(builderForValue.Build());
        return this;
      }
      public Builder AddRangeAttribute(scg::IEnumerable<global::bnet.protocol.attribute.Attribute> values) {
        PrepareBuilder();
        result.attribute_.Add(values);
        return this;
      }
      public Builder ClearAttribute() {
        PrepareBuilder();
        result.attribute_.Clear();
        return this;
      }
    }
    static Role() {
      object.ReferenceEquals(global::bnet.protocol.Proto.RoleSet.Descriptor, null);
    }
  }
  
  [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
  [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
  [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.4.1.473")]
  public sealed partial class RoleSet : pb::GeneratedMessage<RoleSet, RoleSet.Builder> {
    private RoleSet() { }
    private static readonly RoleSet defaultInstance = new RoleSet().MakeReadOnly();
    private static readonly string[] _roleSetFieldNames = new string[] { "attribute", "default_role", "max_members", "program", "role", "service", "subtype" };
    private static readonly uint[] _roleSetFieldTags = new uint[] { 58, 42, 48, 10, 34, 18, 26 };
    public static RoleSet DefaultInstance {
      get { return defaultInstance; }
    }
    
    public override RoleSet DefaultInstanceForType {
      get { return DefaultInstance; }
    }
    
    protected override RoleSet ThisMessage {
      get { return this; }
    }
    
    public static pbd::MessageDescriptor Descriptor {
      get { return global::bnet.protocol.Proto.RoleSet.internal__static_bnet_protocol_RoleSet__Descriptor; }
    }
    
    protected override pb::FieldAccess.FieldAccessorTable<RoleSet, RoleSet.Builder> InternalFieldAccessors {
      get { return global::bnet.protocol.Proto.RoleSet.internal__static_bnet_protocol_RoleSet__FieldAccessorTable; }
    }
    
    public const int ProgramFieldNumber = 1;
    private bool hasProgram;
    private string program_ = "";
    public bool HasProgram {
      get { return hasProgram; }
    }
    public string Program {
      get { return program_; }
    }
    
    public const int ServiceFieldNumber = 2;
    private bool hasService;
    private string service_ = "";
    public bool HasService {
      get { return hasService; }
    }
    public string Service {
      get { return service_; }
    }
    
    public const int SubtypeFieldNumber = 3;
    private bool hasSubtype;
    private string subtype_ = "default";
    public bool HasSubtype {
      get { return hasSubtype; }
    }
    public string Subtype {
      get { return subtype_; }
    }
    
    public const int RoleFieldNumber = 4;
    private pbc::PopsicleList<global::bnet.protocol.Role> role_ = new pbc::PopsicleList<global::bnet.protocol.Role>();
    public scg::IList<global::bnet.protocol.Role> RoleList {
      get { return role_; }
    }
    public int RoleCount {
      get { return role_.Count; }
    }
    public global::bnet.protocol.Role GetRole(int index) {
      return role_[index];
    }
    
    public const int DefaultRoleFieldNumber = 5;
    private int defaultRoleMemoizedSerializedSize;
    private pbc::PopsicleList<uint> defaultRole_ = new pbc::PopsicleList<uint>();
    public scg::IList<uint> DefaultRoleList {
      get { return pbc::Lists.AsReadOnly(defaultRole_); }
    }
    public int DefaultRoleCount {
      get { return defaultRole_.Count; }
    }
    public uint GetDefaultRole(int index) {
      return defaultRole_[index];
    }
    
    public const int MaxMembersFieldNumber = 6;
    private bool hasMaxMembers;
    private int maxMembers_;
    public bool HasMaxMembers {
      get { return hasMaxMembers; }
    }
    public int MaxMembers {
      get { return maxMembers_; }
    }
    
    public const int AttributeFieldNumber = 7;
    private pbc::PopsicleList<global::bnet.protocol.attribute.Attribute> attribute_ = new pbc::PopsicleList<global::bnet.protocol.attribute.Attribute>();
    public scg::IList<global::bnet.protocol.attribute.Attribute> AttributeList {
      get { return attribute_; }
    }
    public int AttributeCount {
      get { return attribute_.Count; }
    }
    public global::bnet.protocol.attribute.Attribute GetAttribute(int index) {
      return attribute_[index];
    }
    
    public override bool IsInitialized {
      get {
        if (!hasProgram) return false;
        if (!hasService) return false;
        foreach (global::bnet.protocol.Role element in RoleList) {
          if (!element.IsInitialized) return false;
        }
        foreach (global::bnet.protocol.attribute.Attribute element in AttributeList) {
          if (!element.IsInitialized) return false;
        }
        return true;
      }
    }
    
    public override void WriteTo(pb::ICodedOutputStream output) {
      int size = SerializedSize;
      string[] field_names = _roleSetFieldNames;
      if (hasProgram) {
        output.WriteString(1, field_names[3], Program);
      }
      if (hasService) {
        output.WriteString(2, field_names[5], Service);
      }
      if (hasSubtype) {
        output.WriteString(3, field_names[6], Subtype);
      }
      if (role_.Count > 0) {
        output.WriteMessageArray(4, field_names[4], role_);
      }
      if (defaultRole_.Count > 0) {
        output.WritePackedUInt32Array(5, field_names[1], defaultRoleMemoizedSerializedSize, defaultRole_);
      }
      if (hasMaxMembers) {
        output.WriteInt32(6, field_names[2], MaxMembers);
      }
      if (attribute_.Count > 0) {
        output.WriteMessageArray(7, field_names[0], attribute_);
      }
      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.ComputeStringSize(1, Program);
        }
        if (hasService) {
          size += pb::CodedOutputStream.ComputeStringSize(2, Service);
        }
        if (hasSubtype) {
          size += pb::CodedOutputStream.ComputeStringSize(3, Subtype);
        }
        foreach (global::bnet.protocol.Role element in RoleList) {
          size += pb::CodedOutputStream.ComputeMessageSize(4, element);
        }
        {
          int dataSize = 0;
          foreach (uint element in DefaultRoleList) {
            dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element);
          }
          size += dataSize;
          if (defaultRole_.Count != 0) {
            size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);
          }
          defaultRoleMemoizedSerializedSize = dataSize;
        }
        if (hasMaxMembers) {
          size += pb::CodedOutputStream.ComputeInt32Size(6, MaxMembers);
        }
        foreach (global::bnet.protocol.attribute.Attribute element in AttributeList) {
          size += pb::CodedOutputStream.ComputeMessageSize(7, element);
        }
        size += UnknownFields.SerializedSize;
        memoizedSerializedSize = size;
        return size;
      }
    }
    
    public static RoleSet ParseFrom(pb::ByteString data) {
      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
    }
    public static RoleSet ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
    }
    public static RoleSet ParseFrom(byte[] data) {
      return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
    }
    public static RoleSet ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
    }
    public static RoleSet ParseFrom(global::System.IO.Stream input) {
      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
    }
    public static RoleSet ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
    }
    public static RoleSet ParseDelimitedFrom(global::System.IO.Stream input) {
      return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
    }
    public static RoleSet ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
      return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
    }
    public static RoleSet ParseFrom(pb::ICodedInputStream input) {
      return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
    }
    public static RoleSet ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
      return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
    }
    private RoleSet MakeReadOnly() {
      role_.MakeReadOnly();
      defaultRole_.MakeReadOnly();
      attribute_.MakeReadOnly();
      return this;
    }
    
    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(RoleSet prototype) {
      return new Builder(prototype);
    }
    
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("ProtoGen", "2.4.1.473")]
    public sealed partial class Builder : pb::GeneratedBuilder<RoleSet, Builder> {
      protected override Builder ThisBuilder {
        get { return this; }
      }
      public Builder() {
        result = DefaultInstance;
        resultIsReadOnly = true;
      }
      internal Builder(RoleSet cloneFrom) {
        result = cloneFrom;
        resultIsReadOnly = true;
      }
      
      private bool resultIsReadOnly;
      private RoleSet result;
      
      private RoleSet PrepareBuilder() {
        if (resultIsReadOnly) {
          RoleSet original = result;
          result = new RoleSet();
          resultIsReadOnly = false;
          MergeFrom(original);
        }
        return result;
      }
      
      public override bool IsInitialized {
        get { return result.IsInitialized; }
      }
      
      protected override RoleSet MessageBeingBuilt {
        get { return PrepareBuilder(); }
      }
      
      public override Builder Clear() {
        result = DefaultInstance;
        resultIsReadOnly = true;
        return this;
      }
      
      public override Builder Clone() {
        if (resultIsReadOnly) {
          return new Builder(result);
        } else {
          return new Builder().MergeFrom(result);
        }
      }
      
      public override pbd::MessageDescriptor DescriptorForType {
        get { return global::bnet.protocol.RoleSet.Descriptor; }
      }
      
      public override RoleSet DefaultInstanceForType {
        get { return global::bnet.protocol.RoleSet.DefaultInstance; }
      }
      
      public override RoleSet BuildPartial() {
        if (resultIsReadOnly) {
          return result;
        }
        resultIsReadOnly = true;
        return result.MakeReadOnly();
      }
      
      public override Builder MergeFrom(pb::IMessage other) {
        if (other is RoleSet) {
          return MergeFrom((RoleSet) other);
        } else {
          base.MergeFrom(other);
          return this;
        }
      }
      
      public override Builder MergeFrom(RoleSet other) {
        if (other == global::bnet.protocol.RoleSet.DefaultInstance) return this;
        PrepareBuilder();
        if (other.HasProgram) {
          Program = other.Program;
        }
        if (other.HasService) {
          Service = other.Service;
        }
        if (other.HasSubtype) {
          Subtype = other.Subtype;
        }
        if (other.role_.Count != 0) {
          result.role_.Add(other.role_);
        }
        if (other.defaultRole_.Count != 0) {
          result.defaultRole_.Add(other.defaultRole_);
        }
        if (other.HasMaxMembers) {
          MaxMembers = other.MaxMembers;
        }
        if (other.attribute_.Count != 0) {
          result.attribute_.Add(other.attribute_);
        }
        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) {
        PrepareBuilder();
        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(_roleSetFieldNames, field_name, global::System.StringComparer.Ordinal);
            if(field_ordinal >= 0)
              tag = _roleSetFieldTags[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: {
              result.hasProgram = input.ReadString(ref result.program_);
              break;
            }
            case 18: {
              result.hasService = input.ReadString(ref result.service_);
              break;
            }
            case 26: {
              result.hasSubtype = input.ReadString(ref result.subtype_);
              break;
            }
            case 34: {
              input.ReadMessageArray(tag, field_name, result.role_, global::bnet.protocol.Role.DefaultInstance, extensionRegistry);
              break;
            }
            case 42:
            case 40: {
              input.ReadUInt32Array(tag, field_name, result.defaultRole_);
              break;
            }
            case 48: {
              result.hasMaxMembers = input.ReadInt32(ref result.maxMembers_);
              break;
            }
            case 58: {
              input.ReadMessageArray(tag, field_name, result.attribute_, global::bnet.protocol.attribute.Attribute.DefaultInstance, extensionRegistry);
              break;
            }
          }
        }
        
        if (unknownFields != null) {
          this.UnknownFields = unknownFields.Build();
        }
        return this;
      }
      
      
      public bool HasProgram {
        get { return result.hasProgram; }
      }
      public string Program {
        get { return result.Program; }
        set { SetProgram(value); }
      }
      public Builder SetProgram(string value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.hasProgram = true;
        result.program_ = value;
        return this;
      }
      public Builder ClearProgram() {
        PrepareBuilder();
        result.hasProgram = false;
        result.program_ = "";
        return this;
      }
      
      public bool HasService {
        get { return result.hasService; }
      }
      public string Service {
        get { return result.Service; }
        set { SetService(value); }
      }
      public Builder SetService(string value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.hasService = true;
        result.service_ = value;
        return this;
      }
      public Builder ClearService() {
        PrepareBuilder();
        result.hasService = false;
        result.service_ = "";
        return this;
      }
      
      public bool HasSubtype {
        get { return result.hasSubtype; }
      }
      public string Subtype {
        get { return result.Subtype; }
        set { SetSubtype(value); }
      }
      public Builder SetSubtype(string value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.hasSubtype = true;
        result.subtype_ = value;
        return this;
      }
      public Builder ClearSubtype() {
        PrepareBuilder();
        result.hasSubtype = false;
        result.subtype_ = "default";
        return this;
      }
      
      public pbc::IPopsicleList<global::bnet.protocol.Role> RoleList {
        get { return PrepareBuilder().role_; }
      }
      public int RoleCount {
        get { return result.RoleCount; }
      }
      public global::bnet.protocol.Role GetRole(int index) {
        return result.GetRole(index);
      }
      public Builder SetRole(int index, global::bnet.protocol.Role value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.role_[index] = value;
        return this;
      }
      public Builder SetRole(int index, global::bnet.protocol.Role.Builder builderForValue) {
        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
        PrepareBuilder();
        result.role_[index] = builderForValue.Build();
        return this;
      }
      public Builder AddRole(global::bnet.protocol.Role value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.role_.Add(value);
        return this;
      }
      public Builder AddRole(global::bnet.protocol.Role.Builder builderForValue) {
        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
        PrepareBuilder();
        result.role_.Add(builderForValue.Build());
        return this;
      }
      public Builder AddRangeRole(scg::IEnumerable<global::bnet.protocol.Role> values) {
        PrepareBuilder();
        result.role_.Add(values);
        return this;
      }
      public Builder ClearRole() {
        PrepareBuilder();
        result.role_.Clear();
        return this;
      }
      
      public pbc::IPopsicleList<uint> DefaultRoleList {
        get { return PrepareBuilder().defaultRole_; }
      }
      public int DefaultRoleCount {
        get { return result.DefaultRoleCount; }
      }
      public uint GetDefaultRole(int index) {
        return result.GetDefaultRole(index);
      }
      public Builder SetDefaultRole(int index, uint value) {
        PrepareBuilder();
        result.defaultRole_[index] = value;
        return this;
      }
      public Builder AddDefaultRole(uint value) {
        PrepareBuilder();
        result.defaultRole_.Add(value);
        return this;
      }
      public Builder AddRangeDefaultRole(scg::IEnumerable<uint> values) {
        PrepareBuilder();
        result.defaultRole_.Add(values);
        return this;
      }
      public Builder ClearDefaultRole() {
        PrepareBuilder();
        result.defaultRole_.Clear();
        return this;
      }
      
      public bool HasMaxMembers {
        get { return result.hasMaxMembers; }
      }
      public int MaxMembers {
        get { return result.MaxMembers; }
        set { SetMaxMembers(value); }
      }
      public Builder SetMaxMembers(int value) {
        PrepareBuilder();
        result.hasMaxMembers = true;
        result.maxMembers_ = value;
        return this;
      }
      public Builder ClearMaxMembers() {
        PrepareBuilder();
        result.hasMaxMembers = false;
        result.maxMembers_ = 0;
        return this;
      }
      
      public pbc::IPopsicleList<global::bnet.protocol.attribute.Attribute> AttributeList {
        get { return PrepareBuilder().attribute_; }
      }
      public int AttributeCount {
        get { return result.AttributeCount; }
      }
      public global::bnet.protocol.attribute.Attribute GetAttribute(int index) {
        return result.GetAttribute(index);
      }
      public Builder SetAttribute(int index, global::bnet.protocol.attribute.Attribute value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.attribute_[index] = value;
        return this;
      }
      public Builder SetAttribute(int index, global::bnet.protocol.attribute.Attribute.Builder builderForValue) {
        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
        PrepareBuilder();
        result.attribute_[index] = builderForValue.Build();
        return this;
      }
      public Builder AddAttribute(global::bnet.protocol.attribute.Attribute value) {
        pb::ThrowHelper.ThrowIfNull(value, "value");
        PrepareBuilder();
        result.attribute_.Add(value);
        return this;
      }
      public Builder AddAttribute(global::bnet.protocol.attribute.Attribute.Builder builderForValue) {
        pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue");
        PrepareBuilder();
        result.attribute_.Add(builderForValue.Build());
        return this;
      }
      public Builder AddRangeAttribute(scg::IEnumerable<global::bnet.protocol.attribute.Attribute> values) {
        PrepareBuilder();
        result.attribute_.Add(values);
        return this;
      }
      public Builder ClearAttribute() {
        PrepareBuilder();
        result.attribute_.Clear();
        return this;
      }
    }
    static RoleSet() {
      object.ReferenceEquals(global::bnet.protocol.Proto.RoleSet.Descriptor, null);
    }
  }
  
  #endregion
  
}

#endregion Designer generated code
