public static CreateChannelRequest DeserializeLengthDelimited(Stream stream, CreateChannelRequest instance) { long position = (long)ProtocolParser.ReadUInt32(stream); position += stream.Position; return(CreateChannelRequest.Deserialize(stream, instance, position)); }
public static CreateChannelRequest DeserializeLengthDelimited(Stream stream, CreateChannelRequest instance) { long num = (long)((ulong)ProtocolParser.ReadUInt32(stream)); num += stream.get_Position(); return(CreateChannelRequest.Deserialize(stream, instance, num)); }
public static CreateChannelRequest DeserializeLengthDelimited(Stream stream) { CreateChannelRequest createChannelRequest = new CreateChannelRequest(); CreateChannelRequest.DeserializeLengthDelimited(stream, createChannelRequest); return(createChannelRequest); }
public static void Serialize(Stream stream, CreateChannelRequest instance) { if (instance.HasAgentIdentity) { stream.WriteByte(10); ProtocolParser.WriteUInt32(stream, instance.AgentIdentity.GetSerializedSize()); Identity.Serialize(stream, instance.AgentIdentity); } if (instance.HasMemberState) { stream.WriteByte(18); ProtocolParser.WriteUInt32(stream, instance.MemberState.GetSerializedSize()); bnet.protocol.channel.MemberState.Serialize(stream, instance.MemberState); } if (instance.HasChannelState) { stream.WriteByte(26); ProtocolParser.WriteUInt32(stream, instance.ChannelState.GetSerializedSize()); bnet.protocol.channel.ChannelState.Serialize(stream, instance.ChannelState); } if (instance.HasChannelId) { stream.WriteByte(34); ProtocolParser.WriteUInt32(stream, instance.ChannelId.GetSerializedSize()); EntityId.Serialize(stream, instance.ChannelId); } if (instance.HasObjectId) { stream.WriteByte(40); ProtocolParser.WriteUInt64(stream, instance.ObjectId); } if (instance.HasLocalAgent) { stream.WriteByte(50); ProtocolParser.WriteUInt32(stream, instance.LocalAgent.GetSerializedSize()); EntityId.Serialize(stream, instance.LocalAgent); } if (instance.HasLocalMemberState) { stream.WriteByte(58); ProtocolParser.WriteUInt32(stream, instance.LocalMemberState.GetSerializedSize()); bnet.protocol.channel.MemberState.Serialize(stream, instance.LocalMemberState); } }
public override bool Equals(object obj) { CreateChannelRequest createChannelRequest = obj as CreateChannelRequest; if (createChannelRequest == null) { return(false); } if (this.HasAgentIdentity != createChannelRequest.HasAgentIdentity || this.HasAgentIdentity && !this.AgentIdentity.Equals(createChannelRequest.AgentIdentity)) { return(false); } if (this.HasMemberState != createChannelRequest.HasMemberState || this.HasMemberState && !this.MemberState.Equals(createChannelRequest.MemberState)) { return(false); } if (this.HasChannelState != createChannelRequest.HasChannelState || this.HasChannelState && !this.ChannelState.Equals(createChannelRequest.ChannelState)) { return(false); } if (this.HasChannelId != createChannelRequest.HasChannelId || this.HasChannelId && !this.ChannelId.Equals(createChannelRequest.ChannelId)) { return(false); } if (this.HasObjectId != createChannelRequest.HasObjectId || this.HasObjectId && !this.ObjectId.Equals(createChannelRequest.ObjectId)) { return(false); } if (this.HasLocalAgent != createChannelRequest.HasLocalAgent || this.HasLocalAgent && !this.LocalAgent.Equals(createChannelRequest.LocalAgent)) { return(false); } if (this.HasLocalMemberState == createChannelRequest.HasLocalMemberState && (!this.HasLocalMemberState || this.LocalMemberState.Equals(createChannelRequest.LocalMemberState))) { return(true); } return(false); }
public void Serialize(Stream stream) { CreateChannelRequest.Serialize(stream, this); }
public static CreateChannelRequest Deserialize(Stream stream, CreateChannelRequest instance, long limit) { while (true) { if (limit < (long)0 || stream.Position < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= (long)0) { throw new EndOfStreamException(); } break; } else if (num == 10) { if (instance.AgentIdentity != null) { Identity.DeserializeLengthDelimited(stream, instance.AgentIdentity); } else { instance.AgentIdentity = Identity.DeserializeLengthDelimited(stream); } } else if (num == 18) { if (instance.MemberState != null) { bnet.protocol.channel.MemberState.DeserializeLengthDelimited(stream, instance.MemberState); } else { instance.MemberState = bnet.protocol.channel.MemberState.DeserializeLengthDelimited(stream); } } else if (num == 26) { if (instance.ChannelState != null) { bnet.protocol.channel.ChannelState.DeserializeLengthDelimited(stream, instance.ChannelState); } else { instance.ChannelState = bnet.protocol.channel.ChannelState.DeserializeLengthDelimited(stream); } } else if (num == 34) { if (instance.ChannelId != null) { EntityId.DeserializeLengthDelimited(stream, instance.ChannelId); } else { instance.ChannelId = EntityId.DeserializeLengthDelimited(stream); } } else if (num == 40) { instance.ObjectId = ProtocolParser.ReadUInt64(stream); } else if (num == 50) { if (instance.LocalAgent != null) { EntityId.DeserializeLengthDelimited(stream, instance.LocalAgent); } else { instance.LocalAgent = EntityId.DeserializeLengthDelimited(stream); } } else if (num != 58) { Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else if (instance.LocalMemberState != null) { bnet.protocol.channel.MemberState.DeserializeLengthDelimited(stream, instance.LocalMemberState); } else { instance.LocalMemberState = bnet.protocol.channel.MemberState.DeserializeLengthDelimited(stream); } } else { if (stream.Position != limit) { throw new ProtocolBufferException("Read past max limit"); } break; } } return(instance); }
public static CreateChannelRequest Deserialize(Stream stream, CreateChannelRequest instance) { return(CreateChannelRequest.Deserialize(stream, instance, (long)-1)); }
public override void CreateChannel(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.channel.CreateChannelRequest request, Action <bnet.protocol.channel.CreateChannelResponse> done) { var channel_id = bnet.protocol.EntityId.CreateBuilder().SetLow(11233645142038554527).SetHigh(433661094618860925).Build(); var response = CreateChannelResponse.CreateBuilder(); response.SetObjectId(1234); response.SetChannelId(channel_id); done(response.Build()); /*var field1 = bnet.protocol.presence.Field.CreateBuilder() * .SetKey(bnet.protocol.presence.FieldKey.CreateBuilder().SetProgram(16974).SetGroup(3).SetField(3).SetIndex(0)) * .SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetBoolValue(true)); * * var field2 = bnet.protocol.presence.Field.CreateBuilder() * .SetKey(bnet.protocol.presence.FieldKey.CreateBuilder().SetProgram(16974).SetGroup(3).SetField(10).SetIndex(0)) * .SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetIntValue(1315530390868296)); * * var field3 = bnet.protocol.presence.Field.CreateBuilder() * .SetKey(bnet.protocol.presence.FieldKey.CreateBuilder().SetProgram(16974).SetGroup(3).SetField(11).SetIndex(0)) * .SetValue(bnet.protocol.attribute.Variant.CreateBuilder().SetMessageValue( * ByteString.CopyFrom(new byte[] { 0x9, 0x46, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4, 0x11, 0xdd, 0xb4, 0x63, 0xe7, 0x82, 0x44, 0x68, 0x4e }))); * * * var fieldOperation1 = bnet.protocol.presence.FieldOperation.CreateBuilder().SetField(field1); * var fieldOperation2 = bnet.protocol.presence.FieldOperation.CreateBuilder().SetField(field2); * var fieldOperation3 = bnet.protocol.presence.FieldOperation.CreateBuilder().SetField(field3); * * var state = bnet.protocol.presence.ChannelState.CreateBuilder() * .SetEntityId(channel_id) * .AddFieldOperation(fieldOperation1) * .AddFieldOperation(fieldOperation2) * .AddFieldOperation(fieldOperation3); * * * var channelState = bnet.protocol.channel.ChannelState.CreateBuilder().SetExtension(bnet.protocol.presence.ChannelState.Presence, state.Build()); * var notif = bnet.protocol.channel.UpdateChannelStateNotification.CreateBuilder().SetStateChange(channelState).Build(); * * var serv = client.GetImportedService<ChannelSubscriber>(); * serv.NotifyUpdateChannelState(null, notif, d => { });*/ var notification = new AddNotification.Builder { Self = new Member.Builder { Identity = new Identity.Builder { AccountId = new EntityId.Builder { High = 0x100000000000000, Low = 1234 }.Build(), GameAccountId = new EntityId.Builder { High = 0x200006200004433, Low = 1234, }.Build(), ToonId = new EntityId.Builder { High = 0x300016200004433, Low = 2, }.Build() }.Build(), State = new MemberState.Builder { Privileges = 64511, }.AddRole(2).Build(), }.Build(), ChannelState = new ChannelState.Builder { MaxMembers = 8, MinMembers = 1, MaxInvitations = 12, PrivacyLevel = ChannelState.Types.PrivacyLevel.PRIVACY_LEVEL_OPEN_INVITATION }.Build() }.AddMember(new Member.Builder { Identity = new Identity.Builder { ToonId = new EntityId.Builder { High = 0x300016200004433, Low = 2, }.Build() }.Build(), State = new MemberState.Builder { Privileges = 64511, }.AddRole(2).Build(), }.Build()); client.GetImportedService <ChannelSubscriber>().NotifyAdd(null, notification.Build(), null); }
public override bool Equals(object obj) { CreateChannelRequest createChannelRequest = obj as CreateChannelRequest; return(createChannelRequest != null && this.HasAgentIdentity == createChannelRequest.HasAgentIdentity && (!this.HasAgentIdentity || this.AgentIdentity.Equals(createChannelRequest.AgentIdentity)) && this.HasMemberState == createChannelRequest.HasMemberState && (!this.HasMemberState || this.MemberState.Equals(createChannelRequest.MemberState)) && this.HasChannelState == createChannelRequest.HasChannelState && (!this.HasChannelState || this.ChannelState.Equals(createChannelRequest.ChannelState)) && this.HasChannelId == createChannelRequest.HasChannelId && (!this.HasChannelId || this.ChannelId.Equals(createChannelRequest.ChannelId)) && this.HasObjectId == createChannelRequest.HasObjectId && (!this.HasObjectId || this.ObjectId.Equals(createChannelRequest.ObjectId)) && this.HasLocalAgent == createChannelRequest.HasLocalAgent && (!this.HasLocalAgent || this.LocalAgent.Equals(createChannelRequest.LocalAgent)) && this.HasLocalMemberState == createChannelRequest.HasLocalMemberState && (!this.HasLocalMemberState || this.LocalMemberState.Equals(createChannelRequest.LocalMemberState))); }
public static CreateChannelRequest Deserialize(Stream stream, CreateChannelRequest instance, long limit) { while (limit < 0L || stream.get_Position() < limit) { int num = stream.ReadByte(); if (num == -1) { if (limit >= 0L) { throw new EndOfStreamException(); } return(instance); } else { int num2 = num; if (num2 != 10) { if (num2 != 18) { if (num2 != 26) { if (num2 != 34) { if (num2 != 40) { if (num2 != 50) { if (num2 != 58) { Key key = ProtocolParser.ReadKey((byte)num, stream); uint field = key.Field; if (field == 0u) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } else if (instance.LocalMemberState == null) { instance.LocalMemberState = MemberState.DeserializeLengthDelimited(stream); } else { MemberState.DeserializeLengthDelimited(stream, instance.LocalMemberState); } } else if (instance.LocalAgent == null) { instance.LocalAgent = EntityId.DeserializeLengthDelimited(stream); } else { EntityId.DeserializeLengthDelimited(stream, instance.LocalAgent); } } else { instance.ObjectId = ProtocolParser.ReadUInt64(stream); } } else if (instance.ChannelId == null) { instance.ChannelId = EntityId.DeserializeLengthDelimited(stream); } else { EntityId.DeserializeLengthDelimited(stream, instance.ChannelId); } } else if (instance.ChannelState == null) { instance.ChannelState = ChannelState.DeserializeLengthDelimited(stream); } else { ChannelState.DeserializeLengthDelimited(stream, instance.ChannelState); } } else if (instance.MemberState == null) { instance.MemberState = MemberState.DeserializeLengthDelimited(stream); } else { MemberState.DeserializeLengthDelimited(stream, instance.MemberState); } } else if (instance.AgentIdentity == null) { instance.AgentIdentity = Identity.DeserializeLengthDelimited(stream); } else { Identity.DeserializeLengthDelimited(stream, instance.AgentIdentity); } } } if (stream.get_Position() == limit) { return(instance); } throw new ProtocolBufferException("Read past max limit"); }