public void PostJoin() { var fhc = new FileHashCalculator(); fhc.CalculateHashes(GameModes); SendMessageToHost(FILE_HASH_COMMAND + " " + fhc.GetCompleteHash()); }
public void PostJoin() { var fhc = new FileHashCalculator(); fhc.CalculateHashes(gameModes); SendMessageToHost(FILE_HASH_COMMAND + " " + fhc.GetCompleteHash()); UpdateDiscordPresence(true); }
/// <summary> /// Called when the local user has joined the game channel. /// </summary> public void OnJoined() { FileHashCalculator fhc = new FileHashCalculator(); fhc.CalculateHashes(gameModes); if (IsHost) { connectionManager.SendCustomMessage(new QueuedMessage( string.Format("MODE {0} +klnNs {1} {2}", channel.ChannelName, channel.Password, SGPlayers.Count), QueuedMessageType.SYSTEM_MESSAGE, 50)); connectionManager.SendCustomMessage(new QueuedMessage( string.Format("TOPIC {0} :{1}", channel.ChannelName, ProgramConstants.CNCNET_PROTOCOL_REVISION + ";" + localGame.ToLower()), QueuedMessageType.SYSTEM_MESSAGE, 50)); gameFilesHash = fhc.GetCompleteHash(); gameBroadcastTimer.Enabled = true; gameBroadcastTimer.Start(); gameBroadcastTimer.SetTime(TimeSpan.FromSeconds(INITIAL_GAME_BROADCAST_DELAY)); } else { channel.SendCTCPMessage(FILE_HASH_CTCP_COMMAND + " " + fhc.GetCompleteHash(), QueuedMessageType.SYSTEM_MESSAGE, 10); channel.SendCTCPMessage(TUNNEL_PING_CTCP_COMMAND + " " + tunnel.PingInMs, QueuedMessageType.SYSTEM_MESSAGE, 10); if (tunnel.PingInMs < 0) { AddNotice(ProgramConstants.PLAYERNAME + " - unknown ping to tunnel server."); } else { AddNotice(ProgramConstants.PLAYERNAME + " - ping to tunnel server: " + tunnel.PingInMs + " ms"); } } topBar.AddPrimarySwitchable(this); topBar.SwitchToPrimary(); WindowManager.SelectedControl = tbChatInput; UpdateDiscordPresence(true); }
public void SetUp(bool isHost, IPEndPoint hostEndPoint, TcpClient client, int loadedGameId) { Refresh(isHost); this.hostEndPoint = hostEndPoint; this.loadedGameId = loadedGameId; started = false; if (isHost) { Thread thread = new Thread(ListenForClients); thread.Start(); this.client = new TcpClient(); this.client.Connect("127.0.0.1", ProgramConstants.LAN_GAME_LOBBY_PORT); byte[] buffer = encoding.GetBytes(PLAYER_JOIN_COMMAND + ProgramConstants.LAN_DATA_SEPARATOR + ProgramConstants.PLAYERNAME + ProgramConstants.LAN_DATA_SEPARATOR + loadedGameId); this.client.GetStream().Write(buffer, 0, buffer.Length); this.client.GetStream().Flush(); var fhc = new FileHashCalculator(); fhc.CalculateHashes(gameModes); localFileHash = fhc.GetCompleteHash(); } else { this.client = client; } new Thread(HandleServerCommunication).Start(); if (IsHost) { CopyPlayerDataToUI(); } WindowManager.SelectedControl = tbChatInput; }