internal void DeclineClanInvite(ulong clanID) { var request = new ClientMsg<CMsgClientClanInviteAction>((int) EMsg.ClientAcknowledgeClanInvite); request.Body.GroupID = clanID; request.Body.AcceptInvite = false; Client.Send(request); }
void HandleNumberOfPlayersResponse( IPacketMsg packetMsg ) { var msg = new ClientMsg<MsgClientGetNumberOfCurrentPlayersResponse>( packetMsg ); var callback = new NumberOfPlayersCallback( msg.Header.TargetJobID, msg.Body ); Client.PostCallback( callback ); }
void HandleServerUnavailable(IPacketMsg packetMsg) { var msgServerUnavailable = new ClientMsg <MsgClientServerUnavailable>(packetMsg); LogDebug("SteamClient", "A server of type '{0}' was not available for request: '{1}'", msgServerUnavailable.Body.EServerTypeUnavailable, ( EMsg )msgServerUnavailable.Body.EMsgSent); Disconnect(userInitiated: false); }
public void PayloadReaderReadsNullTermString() { var msg = new ClientMsg <MsgClientChatEnter>(BuildStructMsg()); string chatName = msg.ReadNullTermString(); Assert.Equal("Saxton Hell", chatName); }
public void PayloadReaderReadsNullTermString() { var msg = new ClientMsg<MsgClientChatEnter>( BuildStructMsg() ); string chatName = msg.ReadNullTermString(); Assert.Equal( chatName, "Saxton Hell" ); }
internal void AcceptClanInvite(ulong clanID) { var request = new ClientMsg <CMsgClientClanInviteAction>((int)EMsg.ClientAcknowledgeClanInvite); request.Body.GroupID = clanID; request.Body.AcceptInvite = true; Client.Send(request); }
/// <summary> /// Accepts the invite to a Steam Group /// </summary> /// <param name="group">SteamID of the group to accept the invite from.</param> private void AcceptGroupInvite(SteamID group) { var AcceptInvite = new ClientMsg <CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite); AcceptInvite.Body.GroupID = group.ConvertToUInt64(); AcceptInvite.Body.AcceptInvite = true; this.SteamClient.Send(AcceptInvite); }
/// <summary> /// Declines the invite to a Steam Group /// </summary> /// <param name="group">SteamID of the group to decline the invite from.</param> private void DeclineGroupInvite(SteamID group) { var DeclineInvite = new ClientMsg <CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite); DeclineInvite.Body.GroupID = group.ConvertToUInt64(); DeclineInvite.Body.AcceptInvite = false; this.SteamClient.Send(DeclineInvite); }
/// <summary> /// Отправить сообщение в сокет /// </summary> public void SendMessage(IEnumerable <InformationRequest> msgs) { var clientMessage = new ClientMsg(); foreach (var msg in msgs) { clientMessage.information_request.Add(msg); } SendMessageImpl(clientMessage); }
/// <summary> /// Отправить сообщение в сокет /// </summary> public void SendMessage(IEnumerable <MarketDataSubscription> msgs) { var clientMessage = new ClientMsg(); foreach (var msg in msgs) { clientMessage.market_data_subscription.Add(msg); } SendMessageImpl(clientMessage); }
/// <summary> /// Accepts the invite to a Steam Group /// </summary> /// <param name="group">SteamID of the group to accept the invite from.</param> private void AcceptGroupInvite(SteamID group) { var acceptMsg = new ClientMsg <CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite); acceptMsg.Body.GroupID = group.ConvertToUInt64(); acceptMsg.Body.AcceptInvite = true; SteamClient.Send(acceptMsg); Log.Success("Accepted group invite to {0}.", group.ToString()); }
/// <summary> /// Declines the invite to a Steam Group /// </summary> /// <param name="group">SteamID of the group to decline the invite from.</param> private void DeclineGroupInvite(SteamID group) { var declineMsg = new ClientMsg <CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite); declineMsg.Body.GroupID = group.ConvertToUInt64(); declineMsg.Body.AcceptInvite = false; SteamClient.Send(declineMsg); Log.Info("Declined group invite to {0}.", group.ToString()); }
public Task Logon() { var LogonMessage = new ClientMsg(); LogonMessage.logon = new Logon(); LogonMessage.logon.user_name = "WebTrader"; LogonMessage.logon.password = "******"; return(Task.Run(() => _clientWebSocket.SendAsync(new ArraySegment <byte>(ProtoSerialize(LogonMessage)), WebSocketMessageType.Binary, true, CancellationToken.None))); }
/// <summary> /// Invites a use to the specified Steam Group /// </summary> /// <param name="user">SteamID of the user to invite.</param> /// <param name="groupId">SteamID of the group to invite the user to.</param> public void InviteUserToGroup(SteamID user, SteamID groupId) { var InviteUser = new ClientMsg <CMsgInviteUserToGroup>((int)EMsg.ClientInviteUserToClan); InviteUser.Body.GroupID = groupId.ConvertToUInt64(); InviteUser.Body.Invitee = user.ConvertToUInt64(); InviteUser.Body.UnknownInfo = true; this.SteamClient.Send(InviteUser); }
/// <summary> /// Retrieves the number of current players for a given <see cref="GameID"/>. /// Results are returned in a <see cref="NumberOfPlayersCallback"/>. /// </summary> /// <param name="gameId">The GameID to request the number of players for.</param> /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="NumberOfPlayersCallback"/>.</returns> public AsyncJob<NumberOfPlayersCallback> GetNumberOfCurrentPlayers( GameID gameId ) { var msg = new ClientMsg<MsgClientGetNumberOfCurrentPlayers>(); msg.SourceJobID = Client.GetNextJobID(); msg.Body.GameID = gameId; Client.Send( msg ); return new AsyncJob<NumberOfPlayersCallback>( this.Client, msg.SourceJobID ); }
/// <summary> /// Retrieves the number of current players for a given <see cref="GameID"/>. /// Results are returned in a <see cref="NumberOfPlayersCallback"/>. /// </summary> /// <param name="gameId">The GameID to request the number of players for.</param> /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="NumberOfPlayersCallback"/>.</returns> public JobID GetNumberOfCurrentPlayers( GameID gameId ) { var msg = new ClientMsg<MsgClientGetNumberOfCurrentPlayers>(); msg.SourceJobID = Client.GetNextJobID(); msg.Body.GameID = gameId; Client.Send( msg ); return msg.SourceJobID; }
public void BeginGameServerSession() { TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); var msg = new ClientMsg <MsgClientOGSBeginSession>(); msg.Body.AccountId = Bot.Client.SteamID; msg.Body.AccountType = (byte)Bot.Client.SteamID.AccountType; msg.Body.AppId = App; msg.Body.TimeStarted = (uint)t.TotalSeconds; Bot.Client.Send(msg); }
//----< called by UI thread when dispatched from rcvThrd >------- void OnNewMessageHandler(ClientMsg msg2) { if (msg2.cmd.ToString() == "ProjectList") { listBox1.Items.Insert(0, "Received message ProjectList from Server:"); XDocument doc = new XDocument(); doc = XDocument.Parse(msg2.body); List <string> files = new List <string>(); var q = from x in doc.Root.Elements("filename") select x; foreach (string x in q) { files.Add(x.ToString()); } string[] fileList = files.ToArray(); for (int i = 0; i < fileList.Length; i++) { listBox1.Items.Insert(i + 1, fileList[i]); } } if (msg2.cmd.ToString() == "DependencyAnalysis") { listBox1.Items.Clear(); string name = msg2.body; List <string> names = name.Split('!').ToList(); int i = 0; if (Types.IsChecked.Value) { listBox1.Items.Insert(i, "Type Dependency Analysis"); List <string> name1 = names[0].Split(',').ToList(); foreach (string str in name1) { listBox1.Items.Insert(i, str); i++; } } if (Packages.IsChecked.Value) { listBox1.Items.Insert(i, "Package Dependencies"); List <string> name2 = names[1].Split(',').ToList(); foreach (string str in name2) { listBox1.Items.Insert(i, str); i++; } } if (!(Types.IsChecked.Value || Packages.IsChecked.Value)) { listBox1.Items.Insert(i, "no option selected"); } } }
void HandleNumberOfPlayersResponse( IPacketMsg packetMsg ) { var msg = new ClientMsg<MsgClientGetNumberOfCurrentPlayersResponse>( packetMsg ); #if STATIC_CALLBACKS var innerCallback = new NumberOfPlayersCallback( Client, msg.Body ); var callback = new SteamClient.JobCallback<NumberOfPlayersCallback>( Client, msg.Header.TargetJobID, innerCallback ); SteamClient.PostCallback( callback ); #else var innerCallback = new NumberOfPlayersCallback( msg.Body ); var callback = new SteamClient.JobCallback<NumberOfPlayersCallback>( msg.Header.TargetJobID, innerCallback ); Client.PostCallback( callback ); #endif }
public Task SubsribeAsync(string topicName) { var message = new ClientMsg { Sub = new ClientSub { Id = GenerateMessageId(), Topic = topicName, } }; return(SendMessageAsync(message, message.Sub.Id)); }
internal void DeclineClanInvite(ulong clanID) { if (clanID == 0 || !Client.IsConnected) { return; } var request = new ClientMsg <CMsgClientClanInviteAction>((int)EMsg.ClientAcknowledgeClanInvite); request.Body.GroupID = clanID; request.Body.AcceptInvite = false; Client.Send(request); }
public static void SendClientMsg(object code, object param = null, bool dispatch = false) { ClientMsg msgID = (ClientMsg)((int)code); MobaMessage message = MobaMessageManager.GetMessage(msgID, param, 0f); if (dispatch) { MobaMessageManager.DispatchMsg(message); } else { MobaMessageManager.ExecuteMsg(message); } }
public static ClientMsg ParseFrom(string source) { string[] array = source.Split(SECOND_SPLITER); ClientMsg data = new ClientMsg() { FrameId = int.Parse(array[0]), Guid = array[1], OperationCode = int.Parse(array[2]), SendId = int.Parse(array[3]), OperationInfoStr = array[4] }; return(data); }
private bool Respond(SteamID roomID, string message) { string[] query = StripCommand(message, Options.ChatCommand.Command); if (query != null) { var msg = new ClientMsg <MsgClientChatAction>(); msg.Body.SteamIdChat = SteamHelper.ToChatID(roomID); msg.Body.SteamIdUserToActOn = SteamHelper.ToChatID(roomID); msg.Body.ChatAction = EChatAction.UnlockChat; Bot.steamClient.Send(msg); return(true); } return(false); }
public void ClientMsgProtobufAssertsInitializedWithProtoMsg() { var packetMsgData = new ClientMsg <MsgClientLogon>().Serialize(); var packetMsg = new PacketClientMsg(MsgUtil.MakeMsg(EMsg.ClientLogon, protobuf: false), packetMsgData); var exception = Record.Exception(() => new ClientMsgProtobuf <CMsgClientLogon>(packetMsg)); Assert.NotNull(exception); Assert.IsType <TraceAssertException>(exception); var tae = (TraceAssertException)exception; // Can't nameof(ClientMsgProtobuf) - nameof doesn't support open generic types (yet). Assert.Contains($"ClientMsgProtobuf<{typeof( CMsgClientLogon ).FullName}>", tae.AssertMessage); }
private bool Respond(SteamID roomID, string message) { string[] query = StripCommand(message, Options.ChatCommand.Command); if(query != null) { var msg = new ClientMsg<MsgClientChatAction>(); msg.Body.SteamIdChat = SteamHelper.ToChatID(roomID); msg.Body.SteamIdUserToActOn = SteamHelper.ToChatID(roomID); msg.Body.ChatAction = EChatAction.LockChat; Bot.steamClient.Send(msg); return true; } return false; }
public void PayloadReaderDoesNotOverflowPastNullTermString() { var msg = new ClientMsg<MsgClientChatEnter>( BuildStructMsg() ); string chatName = msg.ReadNullTermString(); Assert.Equal( chatName, "Saxton Hell" ); byte nextByte = msg.ReadByte(); char mByte = (char)msg.ReadByte(); // next byte should be a null Assert.Equal( nextByte, 0 ); // and the one after should be the beginning of a MessageObject Assert.Equal( mByte, 'M' ); }
public void PayloadReaderDoesNotOverflowPastNullTermString() { var msg = new ClientMsg <MsgClientChatEnter>(BuildStructMsg()); string chatName = msg.ReadNullTermString(); Assert.Equal(chatName, "Saxton Hell"); byte nextByte = msg.ReadByte(); char mByte = (char)msg.ReadByte(); // next byte should be a null Assert.Equal(nextByte, 0); // and the one after should be the beginning of a MessageObject Assert.Equal(mByte, 'M'); }
private void OnMessage(IPacketMsg packetMsg) { Client.OnMessage(packetMsg); if (packetMsg.MsgType == EMsg.ClientPlayingSessionState) { var pb = new ClientMsgProtobuf <CMsgClientPlayingSessionState>(packetMsg); if (pb.Body.playing_app == 0) { Machine.Trigger(Event.PLAYING_STATE_CLOSED); } else { Machine.Trigger(Event.PLAYING_STATE_OPENED); } } else if (packetMsg.MsgType == EMsg.ClientGetAppOwnershipTicketResponse) { var pb = new ClientMsgProtobuf <CMsgClientGetAppOwnershipTicketResponse>(packetMsg); if (pb.Body.eresult != (uint)EResult.OK) { throw new NotImplementedException("Unable to get app ticket"); } Machine.Trigger(Event.GOT_APP_TICKET); } else if (packetMsg.MsgType == EMsg.ClientAuthListAck) { Machine.Trigger(Event.GOT_AUTH); } else if (packetMsg.MsgType == EMsg.ClientOGSBeginSessionResponse) { var msg = new ClientMsg <MsgClientOGSBeginSessionResponse>(packetMsg); if (msg.Body.Result != EResult.OK) { throw new NotImplementedException("OGSBeginSession not OK"); } Machine.Trigger(Event.GOT_SESSION); } }
public async Task <IEnumerable <TopicSubscribtion> > GetTopicsAsync() { var message = new ClientMsg { Get = new ClientGet { Id = GenerateMessageId(), Topic = "me", Query = new GetQuery { What = "sub" } } }; var rcvMessages = await SendMessageAsync(message, message.Get.Id); return(rcvMessages.Meta.Sub.Select(TopicSubscribtion.FromTopicSub)); }
public async Task <CreateAccountResponse> CreateAccountAsync(string login, string password, string[] tags = null, bool authorize = false) { if (string.IsNullOrEmpty(login)) { throw new ArgumentException("Value cannot be null or empty.", nameof(login)); } if (string.IsNullOrEmpty(password)) { throw new ArgumentException("Value cannot be null or empty.", nameof(password)); } if (login.IndexOf(":", StringComparison.Ordinal) > -1 || password.IndexOf(":", StringComparison.Ordinal) > -1) { throw new ArgumentException("neither the login nor the password should contain ':' symbol"); } var message = new ClientMsg { Acc = new ClientAcc { Id = GenerateMessageId(), UserId = "new", Scheme = "basic", Secret = ByteString.CopyFromUtf8(login + ":" + password), Login = authorize, } }; if (tags?.Any() == true) { message.Acc.Tags.AddRange(tags); } var rcvMsg = await SendMessageAsync(message, message.Acc.Id); rcvMsg.Ctrl.Params.TryGetValue("desc", out var desc); rcvMsg.Ctrl.Params.TryGetValue("user", out var user); rcvMsg.Ctrl.Params.TryGetValue("token", out var token); rcvMsg.Ctrl.Params.TryGetValue("expires", out var expires); return(new CreateAccountResponse(desc?.ToStringUtf8(), user?.ToStringUtf8(), token?.ToStringUtf8(), expires?.ToStringUtf8())); }
/// <summary> /// Отправить сообщение в сокет /// </summary> private void SendMessageImpl(ClientMsg msg) { using (socketLock.Lock()) { if (socket == null || socket.State == WebSocketState.Closed || socket.State == WebSocketState.Closing || socket.State == WebSocketState.Connecting || socket.State == WebSocketState.None ) { Log.Error().Print($"CQG adapter is not connected", LogFields.Login(settings?.Username)); return; } try { byte[] serverMessageRaw; using (var memoryStream = new MemoryStream()) { Serializer.Serialize(memoryStream, msg); serverMessageRaw = memoryStream.ToArray(); } //[ENABLE_CQGC_TRACE]WebApiTrace.OutMessage(msg); socket.Send(serverMessageRaw, 0, serverMessageRaw.Length); } catch (Exception ex) { // В случае сбоя - отключаемся Log.Error().Print(ex, "Failed to send a message"); if (socket != null) { Stop(); socket?.Dispose(); } connectionStatus = ConnectionStatus.Disconnected; } } }
/// <summary> /// Bans the specified chat member from the given chat room. /// </summary> /// <param name="steamIdChat">The SteamID of chat room to ban the member from.</param> /// <param name="steamIdMember">The SteamID of the member to ban from the chat.</param> public void BanChatMember( SteamID steamIdChat, SteamID steamIdMember ) { SteamID chatId = steamIdChat.ConvertToUInt64(); // copy the steamid so we don't modify it var banMember = new ClientMsg<MsgClientChatAction>(); if ( chatId.IsClanAccount ) { // this steamid is incorrect, so we'll fix it up chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan; chatId.AccountType = EAccountType.Chat; } banMember.Body.SteamIdChat = chatId; banMember.Body.SteamIdUserToActOn = steamIdMember; banMember.Body.ChatAction = EChatAction.Ban; this.Client.Send( banMember ); }
internal void AcceptClanInvite(ulong clanID, bool accept) { if (clanID == 0) { ArchiLogger.LogNullError(nameof(clanID)); return; } if (!Client.IsConnected) { return; } ClientMsg <CMsgClientClanInviteAction> request = new ClientMsg <CMsgClientClanInviteAction>(); request.Body.ClanID = clanID; request.Body.AcceptInvite = accept; Client.Send(request); }
protected void Button1_Click(object sender, EventArgs e) { /* * var sf = Ioc.Container.Resolve<ISessionFactory>("SfCompanyMain"); * log.InfoFormat("连接串为:{0}",sf.OpenSession().Connection.ConnectionString); */ for (int i = 0; i < 10; i++) { var sess = Ioc.Container.Resolve <INHSessionManager>(); log.Info(sess.GetHashCode()); } var productRepo = Ioc.Container.Resolve <IProductRepository>("productRepository"); var product = new Product { Category = this.txtCategory.Text.Trim(), Name = this.txtName.Text.Trim() }; productRepo.Add(product); /* * for (int i = 0; i < 5; i++) * { * log.Info("添加了一个分类info:" + this.txtCategory.Text); * log.Warn("添加了一个分类warn:" + this.txtCategory.Text); * log.Error("添加了一个分类error:" + this.txtCategory.Text); * log.FatalFormat("添加了一个分类error:{0},Name:{1}", this.txtCategory.Text, this.txtName.Text); * } */ //ClientMsg.WriteAjax(this, "alert('成功')"); //ClientMsg.Write(this, "alert('成功')"); //ClientMsg.Show(this, "成功啦,恭喜!"); ClientMsg.ShowAjax(this, "ajax成功啦,恭喜!"); //ClientScript.RegisterClientScriptBlock(this.GetType(), "abc", "alert('成功');", true); //在开始标签<form>标签之前添加脚本 //ClientScript.RegisterStartupScript(this.GetType(), "abc", "alert('成功');", true); //在结束标签</form>标签之前添加脚本 ################ //ClientScript.RegisterStartupScript(typeof(Page), "abc", "alert('成功');", true); //在结束标签</form>标签之前添加脚本 ################ //ScriptManager.RegisterClientScriptBlock(this, this.ScriptManager1.GetType(), "abc", "alert('成功');", true); //ScriptManager.RegisterStartupScript(this, typeof(ScriptManager), "abc", "alert('成功2');", true); }
public void OnMessage(IPacketMsg packetMsg) { if (packetMsg.MsgType == EMsg.ClientGetAppOwnershipTicketResponse) { var pb = new ClientMsgProtobuf <CMsgClientGetAppOwnershipTicketResponse>(packetMsg); log.Debug("Got client ticket of " + pb.Body.app_id + " " + pb.Body.eresult + " " + pb.Body.ticket.Length); if (pb.Body.eresult == (uint)EResult.OK) { AppOwnershipTicket = pb.Body.ticket; } } else if (packetMsg.MsgType == EMsg.ClientAuthListAck) { var pb = new ClientMsgProtobuf <CMsgClientAuthListAck>(packetMsg); log.Debug("Steam acked ticket crc of " + pb.Body.ticket_crc + "/" + pb.Body.message_sequence); TicketForAuth = PendingTicketForAuth; TicketForServer = AuthTicket.CreateServerTicket( Bot.Client.SteamID, TicketForAuth, AppOwnershipTicket); } else if (packetMsg.MsgType == EMsg.ClientTicketAuthComplete) { var pb = new ClientMsgProtobuf <CMsgClientTicketAuthComplete>(packetMsg); log.Debug("Client ticket auth complete with " + pb.Body.estate + " on " + pb.Body.ticket_crc); } else if (packetMsg.MsgType == EMsg.ClientOGSBeginSessionResponse) { var msg = new ClientMsg <MsgClientOGSBeginSessionResponse>(packetMsg); if (msg.Body.Result == EResult.OK) { SteamworksSessionId = msg.Body.SessionId; } } }
void ThreadProc() { ClientMsg msg2 = new ClientMsg(); MsgService msgsvc = new MsgService(); try { while (true) { msg2 = msgsvc.GetMessageCS(); // get message out of receive queue - will block if queue is empty if (msg2.body != null) { this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, OnNewMessage, msg2); } } } catch (Exception ex) { MessageBox.Show("A handled exception just occurred: " + ex.Message, "Exception Sample", MessageBoxButton.OK, MessageBoxImage.Warning); } }
internal void AcknowledgeClanInvite(ulong steamID, bool acceptInvite) { if ((steamID == 0) || !new SteamID(steamID).IsClanAccount) { throw new ArgumentNullException(nameof(steamID)); } if (!Client.IsConnected) { return; } ClientMsg <CMsgClientAcknowledgeClanInvite> request = new ClientMsg <CMsgClientAcknowledgeClanInvite> { Body = { ClanID = steamID, AcceptInvite = acceptInvite } }; Client.Send(request); }
private async Task <ConnectResponse> SayHi() { var id = GenerateMessageId(); var message = new ClientMsg { Hi = new ClientHi { Id = id, Ver = "0.15.6-rc5", Lang = "EN", DeviceId = id, UserAgent = "tinode-dotnet-core-client" } }; var rvcMsg = await SendMessageAsync(message, message.Hi.Id); rvcMsg.Ctrl.Params.TryGetValue("ver", out var version); rvcMsg.Ctrl.Params.TryGetValue("build", out var build); return(new ConnectResponse(version?.ToStringUtf8(), build?.ToStringUtf8())); }
/// <summary> /// Sends a message to a chat room. /// </summary> /// <param name="steamIdChat">The SteamID of the chat room.</param> /// <param name="type">The message type.</param> /// <param name="message">The message.</param> public void SendChatRoomMessage( SteamID steamIdChat, EChatEntryType type, string message ) { SteamID chatId = steamIdChat.ConvertToUInt64(); // copy the steamid so we don't modify it if ( chatId.IsClanAccount ) { // this steamid is incorrect, so we'll fix it up chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan; chatId.AccountType = EAccountType.Chat; } var chatMsg = new ClientMsg<MsgClientChatMsg>(); chatMsg.Body.ChatMsgType = type; chatMsg.Body.SteamIdChatRoom = chatId; chatMsg.Body.SteamIdChatter = Client.SteamID; chatMsg.WriteNullTermString( message, Encoding.UTF8 ); this.Client.Send( chatMsg ); }
/// <summary> /// Attempts to leave a chat room. /// </summary> /// <param name="steamId">The SteamID of the chat room.</param> public void LeaveChat( SteamID steamId ) { SteamID chatId = steamId.ConvertToUInt64(); // copy the steamid so we don't modify it var leaveChat = new ClientMsg<MsgClientChatMemberInfo>(); if ( chatId.IsClanAccount ) { // this steamid is incorrect, so we'll fix it up chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan; chatId.AccountType = EAccountType.Chat; } leaveChat.Body.SteamIdChat = chatId; leaveChat.Body.Type = EChatInfoType.StateChange; leaveChat.Write( Client.SteamID.ConvertToUInt64() ); // ChatterActedOn leaveChat.Write( ( uint )EChatMemberStateChange.Left ); // StateChange leaveChat.Write( Client.SteamID.ConvertToUInt64() ); // ChatterActedBy Client.Send( leaveChat ); }
/// <summary> /// Attempts to join a chat room. /// </summary> /// <param name="steamId">The SteamID of the chat room.</param> public void JoinChat( SteamID steamId ) { SteamID chatId = steamId.ConvertToUInt64(); // copy the steamid so we don't modify it var joinChat = new ClientMsg<MsgClientJoinChat>(); if ( chatId.IsClanAccount ) { // this steamid is incorrect, so we'll fix it up chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan; chatId.AccountType = EAccountType.Chat; } joinChat.Body.SteamIdChat = chatId; Client.Send( joinChat ); }
/// <summary> /// Accepts the invite to a Steam Group /// </summary> /// <param name="group">SteamID of the group to accept the invite from.</param> private void AcceptGroupInvite(SteamID group) { var AcceptInvite = new ClientMsg<CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite); AcceptInvite.Body.GroupID = group.ConvertToUInt64(); AcceptInvite.Body.AcceptInvite = true; this.SteamClient.Send(AcceptInvite); }
void HandleChatActionResult( IPacketMsg packetMsg ) { var actionResult = new ClientMsg<MsgClientChatActionResult>( packetMsg ); var callback = new ChatActionResultCallback( actionResult.Body ); this.Client.PostCallback( callback ); }
void HandleChatMsg( IPacketMsg packetMsg ) { var chatMsg = new ClientMsg<MsgClientChatMsg>( packetMsg ); byte[] msgData = chatMsg.Payload.ToArray(); var callback = new ChatMsgCallback( chatMsg.Body, msgData ); this.Client.PostCallback( callback ); }
void HandleChatActionResult( IPacketMsg packetMsg ) { var actionResult = new ClientMsg<MsgClientChatActionResult>( packetMsg ); #if STATIC_CALLBACKS var callback = new ChatActionResultCallback( Client, actionResult.Body ); SteamClient.PostCallback( callback ); #else var callback = new ChatActionResultCallback( actionResult.Body ); this.Client.PostCallback( callback ); #endif }
void HandleChatMemberInfo( IPacketMsg packetMsg ) { var membInfo = new ClientMsg<MsgClientChatMemberInfo>( packetMsg ); byte[] payload = membInfo.Payload.ToArray(); #if STATIC_CALLBACKS var callback = new ChatMemberInfoCallback( Client, membInfo.Body, payload ); SteamClient.PostCallback( callback ); #else var callback = new ChatMemberInfoCallback( membInfo.Body, payload ); this.Client.PostCallback( callback ); #endif }
void HandleChatMsg( IPacketMsg packetMsg ) { var chatMsg = new ClientMsg<MsgClientChatMsg>( packetMsg ); byte[] msgData = chatMsg.Payload.ToArray(); #if STATIC_CALLBACKS var callback = new ChatMsgCallback( Client, chatMsg.Body, msgData ); SteamClient.PostCallback( callback ); #else var callback = new ChatMsgCallback( chatMsg.Body, msgData ); this.Client.PostCallback( callback ); #endif }
void HandleChatEnter( IPacketMsg packetMsg ) { var chatEnter = new ClientMsg<MsgClientChatEnter>( packetMsg ); #if STATIC_CALLBACKS var callback = new ChatEnterCallback( Client, chatEnter.Body ); SteamClient.PostCallback( callback ); #else var callback = new ChatEnterCallback( chatEnter.Body ); this.Client.PostCallback( callback ); #endif }
/// <summary> /// Declines the invite to a Steam Group /// </summary> /// <param name="group">SteamID of the group to decline the invite from.</param> private void DeclineGroupInvite(SteamID group) { var declineMsg = new ClientMsg<CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite); declineMsg.Body.GroupID = group.ConvertToUInt64(); declineMsg.Body.AcceptInvite = false; SteamClient.Send(declineMsg); Log.Info("Declined group invite to {0}.", group.ToString()); }
/// <summary> /// Invites a use to the specified Steam Group /// </summary> /// <param name="user">SteamID of the user to invite.</param> /// <param name="groupId">SteamID of the group to invite the user to.</param> public void InviteUserToGroup(SteamID user, SteamID groupId) { var InviteUser = new ClientMsg<CMsgInviteUserToGroup>((int)EMsg.ClientInviteUserToClan); InviteUser.Body.GroupID = groupId.ConvertToUInt64(); InviteUser.Body.Invitee = user.ConvertToUInt64(); InviteUser.Body.UnknownInfo = true; this.SteamClient.Send(InviteUser); }
/// <summary> /// Ignores or unignores a friend on Steam. /// Results are returned in a <see cref="IgnoreFriendCallback"/>. /// </summary> /// <param name="steamId">The SteamID of the friend to ignore or unignore.</param> /// <param name="setIgnore">if set to <c>true</c>, the friend will be ignored; otherwise, they will be unignored.</param> /// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="IgnoreFriendCallback"/>.</returns> public JobID IgnoreFriend( SteamID steamId, bool setIgnore = true ) { var ignore = new ClientMsg<MsgClientSetIgnoreFriend>(); ignore.SourceJobID = Client.GetNextJobID(); ignore.Body.MySteamId = Client.SteamID; ignore.Body.Ignore = ( byte )( setIgnore ? 1 : 0 ); ignore.Body.SteamIdFriend = steamId; this.Client.Send( ignore ); return ignore.SourceJobID; }
void HandleChatEnter( IPacketMsg packetMsg ) { var chatEnter = new ClientMsg<MsgClientChatEnter>( packetMsg ); byte[] payload = chatEnter.Payload.ToArray(); var callback = new ChatEnterCallback( chatEnter.Body, payload ); this.Client.PostCallback( callback ); }
void HandleIgnoreFriendResponse( IPacketMsg packetMsg ) { var response = new ClientMsg<MsgClientSetIgnoreFriendResponse>( packetMsg ); #if STATIC_CALLBACKS var innerCallback = new IgnoreFriendCallback( Client, response.Body ); var callback = new SteamClient.JobCallback<IgnoreFriendCallback>( Client, response.TargetJobID, innerCallback ); SteamClient.PostCallback( callback ); #else var innerCallback = new IgnoreFriendCallback( response.Body ); var callback = new SteamClient.JobCallback<IgnoreFriendCallback>( response.TargetJobID, innerCallback ); this.Client.PostCallback( callback ); #endif }
void HandleChatRoomInfo( IPacketMsg packetMsg ) { var roomInfo = new ClientMsg<MsgClientChatRoomInfo>( packetMsg ); byte[] payload = roomInfo.Payload.ToArray(); var callback = new ChatRoomInfoCallback( roomInfo.Body, payload ); this.Client.PostCallback( callback ); }
void HandleLoggedOff( IPacketMsg packetMsg ) { EResult result = EResult.Invalid; if ( packetMsg.IsProto ) { var loggedOff = new ClientMsgProtobuf<CMsgClientLoggedOff>( packetMsg ); result = ( EResult )loggedOff.Body.eresult; } else { var loggedOff = new ClientMsg<MsgClientLoggedOff>( packetMsg ); result = loggedOff.Body.Result; } this.Client.PostCallback( new LoggedOffCallback( result ) ); }
void HandleIgnoreFriendResponse( IPacketMsg packetMsg ) { var response = new ClientMsg<MsgClientSetIgnoreFriendResponse>( packetMsg ); var callback = new IgnoreFriendCallback(response.TargetJobID, response.Body); this.Client.PostCallback( callback ); }
void HandleLogOnResponse( IPacketMsg packetMsg ) { if ( packetMsg.IsProto ) { var logonResp = new ClientMsgProtobuf<CMsgClientLogonResponse>( packetMsg ); var callback = new LoggedOnCallback( logonResp.Body ); this.Client.PostCallback( callback ); } else { var logonResp = new ClientMsg<MsgClientLogOnResponse>( packetMsg ); var callback = new LoggedOnCallback( logonResp.Body ); this.Client.PostCallback( callback ); } }
void HandleMarketingMessageUpdate( IPacketMsg packetMsg ) { var marketingMessage = new ClientMsg<MsgClientMarketingMessageUpdate2>( packetMsg ); byte[] payload = marketingMessage.Payload.ToArray(); var callback = new MarketingMessageCallback( marketingMessage.Body, payload ); this.Client.PostCallback( callback ); }
/// <summary> /// Declines the invite to a Steam Group /// </summary> /// <param name="group">SteamID of the group to decline the invite from.</param> private void DeclineGroupInvite(SteamID group) { var DeclineInvite = new ClientMsg<CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite); DeclineInvite.Body.GroupID = group.ConvertToUInt64(); DeclineInvite.Body.AcceptInvite = false; this.SteamClient.Send(DeclineInvite); }