public Channel() { this.BnetEntityID = bnet.protocol.EntityId.CreateBuilder().SetHigh(this.DynamicId).SetLow(0).Build(); var builder = bnet.protocol.channel.ChannelState.CreateBuilder() .SetPrivacyLevel(bnet.protocol.channel.ChannelState.Types.PrivacyLevel.PRIVACY_LEVEL_OPEN) .SetMaxMembers(8) .SetMinMembers(1) .SetMaxInvitations(12); //.SetName("d3sharp test channel"); // NOTE: cap log doesn't set this optional field this.State = builder.Build(); }
public Channel(ulong id) { this.ID = id; this.BnetEntityID = bnet.protocol.EntityId.CreateBuilder().SetHigh(433661094618860925).SetLow(11233645142038554527).Build(); var builder = bnet.protocol.channel.ChannelState.CreateBuilder(); builder.SetPrivacyLevel(bnet.protocol.channel.ChannelState.Types.PrivacyLevel.PRIVACY_LEVEL_OPEN_INVITATION); builder.SetMaxMembers(8); builder.SetMinMembers(1); builder.SetMaxInvitations(12); //builder.SetName("d3sharp test channel"); this.State = builder.Build(); }
public Channel(ulong id) { this.ID = id; this.BnetEntityID = bnet.protocol.EntityId.CreateBuilder().SetLow(id).SetHigh(0x0).Build(); var builder = bnet.protocol.channel.ChannelState.CreateBuilder(); builder.SetPrivacyLevel(bnet.protocol.channel.ChannelState.Types.PrivacyLevel.PRIVACY_LEVEL_OPEN); builder.SetMaxMembers(8); builder.SetMinMembers(1); builder.SetMaxInvitations(12); builder.SetName("d3sharp test channel"); this.State = builder.Build(); }
public Channel(BNetClient client) { this.BnetEntityID = bnet.protocol.EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.ChannelId).SetLow(this.DynamicId).Build(); var builder = bnet.protocol.channel.ChannelState.CreateBuilder() .SetPrivacyLevel(bnet.protocol.channel.ChannelState.Types.PrivacyLevel.PRIVACY_LEVEL_OPEN) .SetMaxMembers(8) .SetMinMembers(1) .SetMaxInvitations(12); //.SetName("d3sharp test channel"); // NOTE: cap log doesn't set this optional field this.State = builder.Build(); // add the client that requested the creation of channel to channel this.AddMember(client); }
public Channel(BNetClient client, ulong remoteObjectId) { this.BnetEntityId = bnet.protocol.EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.ChannelId).SetLow(this.DynamicId).Build(); this.D3EntityId = D3.OnlineService.EntityId.CreateBuilder().SetIdHigh((ulong) EntityIdHelper.HighIdType.ChannelId).SetIdLow(this.DynamicId).Build(); // This is an object creator, so we have to map the remote object ID client.MapLocalObjectID(this.DynamicId, remoteObjectId); var builder = bnet.protocol.channel.ChannelState.CreateBuilder() .SetPrivacyLevel(bnet.protocol.channel.ChannelState.Types.PrivacyLevel.PRIVACY_LEVEL_OPEN_INVITATION) .SetMaxMembers(8) .SetMinMembers(1) .SetMaxInvitations(12); //.SetName("d3sharp test channel"); // NOTE: cap log doesn't set this optional field this.State = builder.Build(); }
public override bool Equals(object obj) { bnet.protocol.channel.ChannelState channelState = obj as bnet.protocol.channel.ChannelState; if (channelState == null) { return(false); } if (this.HasMaxMembers != channelState.HasMaxMembers || (this.HasMaxMembers && !this.MaxMembers.Equals(channelState.MaxMembers))) { return(false); } if (this.HasMinMembers != channelState.HasMinMembers || (this.HasMinMembers && !this.MinMembers.Equals(channelState.MinMembers))) { return(false); } if (this.Attribute.Count != channelState.Attribute.Count) { return(false); } for (int i = 0; i < this.Attribute.Count; i++) { if (!this.Attribute[i].Equals(channelState.Attribute[i])) { return(false); } } if (this.Invitation.Count != channelState.Invitation.Count) { return(false); } for (int j = 0; j < this.Invitation.Count; j++) { if (!this.Invitation[j].Equals(channelState.Invitation[j])) { return(false); } } return(this.HasMaxInvitations == channelState.HasMaxInvitations && (!this.HasMaxInvitations || this.MaxInvitations.Equals(channelState.MaxInvitations)) && this.HasReason == channelState.HasReason && (!this.HasReason || this.Reason.Equals(channelState.Reason)) && this.HasPrivacyLevel == channelState.HasPrivacyLevel && (!this.HasPrivacyLevel || this.PrivacyLevel.Equals(channelState.PrivacyLevel)) && this.HasName == channelState.HasName && (!this.HasName || this.Name.Equals(channelState.Name)) && this.HasDelegateName == channelState.HasDelegateName && (!this.HasDelegateName || this.DelegateName.Equals(channelState.DelegateName)) && this.HasChannelType == channelState.HasChannelType && (!this.HasChannelType || this.ChannelType.Equals(channelState.ChannelType)) && this.HasProgram == channelState.HasProgram && (!this.HasProgram || this.Program.Equals(channelState.Program)) && this.HasAllowOfflineMembers == channelState.HasAllowOfflineMembers && (!this.HasAllowOfflineMembers || this.AllowOfflineMembers.Equals(channelState.AllowOfflineMembers)) && this.HasSubscribeToPresence == channelState.HasSubscribeToPresence && (!this.HasSubscribeToPresence || this.SubscribeToPresence.Equals(channelState.SubscribeToPresence)) && this.HasChat == channelState.HasChat && (!this.HasChat || this.Chat.Equals(channelState.Chat)) && this.HasPresence == channelState.HasPresence && (!this.HasPresence || this.Presence.Equals(channelState.Presence))); }
public void SetChannelState(bnet.protocol.channel.ChannelState val) { this.ChannelState = val; }
public static void Serialize(Stream stream, bnet.protocol.channel.ChannelState instance) { BinaryWriter binaryWriter = new BinaryWriter(stream); if (instance.HasMaxMembers) { stream.WriteByte(8); ProtocolParser.WriteUInt32(stream, instance.MaxMembers); } if (instance.HasMinMembers) { stream.WriteByte(16); ProtocolParser.WriteUInt32(stream, instance.MinMembers); } if (instance.Attribute.Count > 0) { foreach (bnet.protocol.attribute.Attribute attribute in instance.Attribute) { stream.WriteByte(26); ProtocolParser.WriteUInt32(stream, attribute.GetSerializedSize()); bnet.protocol.attribute.Attribute.Serialize(stream, attribute); } } if (instance.Invitation.Count > 0) { foreach (bnet.protocol.invitation.Invitation invitation in instance.Invitation) { stream.WriteByte(34); ProtocolParser.WriteUInt32(stream, invitation.GetSerializedSize()); bnet.protocol.invitation.Invitation.Serialize(stream, invitation); } } if (instance.HasMaxInvitations) { stream.WriteByte(40); ProtocolParser.WriteUInt32(stream, instance.MaxInvitations); } if (instance.HasReason) { stream.WriteByte(48); ProtocolParser.WriteUInt32(stream, instance.Reason); } if (instance.HasPrivacyLevel) { stream.WriteByte(56); ProtocolParser.WriteUInt64(stream, (ulong)instance.PrivacyLevel); } if (instance.HasName) { stream.WriteByte(66); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.Name)); } if (instance.HasDelegateName) { stream.WriteByte(74); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.DelegateName)); } if (instance.HasChannelType) { stream.WriteByte(82); ProtocolParser.WriteBytes(stream, Encoding.UTF8.GetBytes(instance.ChannelType)); } if (instance.HasProgram) { stream.WriteByte(93); binaryWriter.Write(instance.Program); } if (instance.HasAllowOfflineMembers) { stream.WriteByte(96); ProtocolParser.WriteBool(stream, instance.AllowOfflineMembers); } if (instance.HasSubscribeToPresence) { stream.WriteByte(104); ProtocolParser.WriteBool(stream, instance.SubscribeToPresence); } if (instance.HasChat) { stream.WriteByte(162); stream.WriteByte(6); ProtocolParser.WriteUInt32(stream, instance.Chat.GetSerializedSize()); bnet.protocol.chat.ChannelState.Serialize(stream, instance.Chat); } if (instance.HasPresence) { stream.WriteByte(170); stream.WriteByte(6); ProtocolParser.WriteUInt32(stream, instance.Presence.GetSerializedSize()); bnet.protocol.presence.ChannelState.Serialize(stream, instance.Presence); } }
public static bnet.protocol.channel.ChannelState DeserializeLengthDelimited(Stream stream, bnet.protocol.channel.ChannelState instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(bnet.protocol.channel.ChannelState.Deserialize(stream, instance, position)); }
public static bnet.protocol.channel.ChannelState DeserializeLengthDelimited(Stream stream) { bnet.protocol.channel.ChannelState channelState = new bnet.protocol.channel.ChannelState(); bnet.protocol.channel.ChannelState.DeserializeLengthDelimited(stream, channelState); return(channelState); }
public static bnet.protocol.channel.ChannelState Deserialize(Stream stream, bnet.protocol.channel.ChannelState instance, long limit) { BinaryReader binaryReader = new BinaryReader(stream); if (instance.Attribute == null) { instance.Attribute = new List <bnet.protocol.attribute.Attribute>(); } if (instance.Invitation == null) { instance.Invitation = new List <bnet.protocol.invitation.Invitation>(); } instance.PrivacyLevel = bnet.protocol.channel.ChannelState.Types.PrivacyLevel.PRIVACY_LEVEL_OPEN; instance.ChannelType = "default"; instance.Program = 0; instance.AllowOfflineMembers = false; instance.SubscribeToPresence = true; while (true) { if (limit < (long)0 || stream.Position < limit) { int num = stream.ReadByte(); if (num != -1) { switch (num) { case 93: { instance.Program = binaryReader.ReadUInt32(); continue; } case 96: { instance.AllowOfflineMembers = ProtocolParser.ReadBool(stream); continue; } default: { if (num == 8) { instance.MaxMembers = ProtocolParser.ReadUInt32(stream); continue; } else if (num == 16) { instance.MinMembers = ProtocolParser.ReadUInt32(stream); continue; } else if (num == 26) { instance.Attribute.Add(bnet.protocol.attribute.Attribute.DeserializeLengthDelimited(stream)); continue; } else if (num == 34) { instance.Invitation.Add(bnet.protocol.invitation.Invitation.DeserializeLengthDelimited(stream)); continue; } else if (num == 40) { instance.MaxInvitations = ProtocolParser.ReadUInt32(stream); continue; } else if (num == 48) { instance.Reason = ProtocolParser.ReadUInt32(stream); continue; } else if (num == 56) { instance.PrivacyLevel = (bnet.protocol.channel.ChannelState.Types.PrivacyLevel)((int)ProtocolParser.ReadUInt64(stream)); continue; } else if (num == 66) { instance.Name = ProtocolParser.ReadString(stream); continue; } else if (num == 74) { instance.DelegateName = ProtocolParser.ReadString(stream); continue; } else if (num == 82) { instance.ChannelType = ProtocolParser.ReadString(stream); continue; } else if (num == 104) { instance.SubscribeToPresence = ProtocolParser.ReadBool(stream); continue; } else { Key key = ProtocolParser.ReadKey((byte)num, stream); uint field = key.Field; if (field == 100) { if (key.WireType == Wire.LengthDelimited) { if (instance.Chat != null) { bnet.protocol.chat.ChannelState.DeserializeLengthDelimited(stream, instance.Chat); } else { instance.Chat = bnet.protocol.chat.ChannelState.DeserializeLengthDelimited(stream); } continue; } } else if (field != 101) { if (field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else if (key.WireType == Wire.LengthDelimited) { if (instance.Presence != null) { bnet.protocol.presence.ChannelState.DeserializeLengthDelimited(stream, instance.Presence); } else { instance.Presence = bnet.protocol.presence.ChannelState.DeserializeLengthDelimited(stream); } continue; } continue; } } } } else { if (limit >= (long)0) { throw new EndOfStreamException(); } break; } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public static bnet.protocol.channel.ChannelState Deserialize(Stream stream, bnet.protocol.channel.ChannelState instance) { return(bnet.protocol.channel.ChannelState.Deserialize(stream, instance, (long)-1)); }