private void OnConnect(object sender, RoutedEventArgs e) { string host = Host.Text; connector = new PacketProcessing(); ConnectorSubscribe(); connector.SetPort(2010); connector.SetServerHost(host); connector.StartServerConnection(); }
void Connect() { if (!string.IsNullOrEmpty(View.Host) && View.Port > 0) { Disconnect(); connector = new PacketProcessing(); ConnectorSubscribe(); connector.SetPort(View.Port); connector.SetServerHost(View.Host); connector.StartServerConnection(); } else { View.UnableToConnect(); } }
private void OnStartServer(object sender, RoutedEventArgs e) { if (ServerConnection != null) { ServerConnection.Dispose(); } ServerConnection = new ArtemisComm.PacketProcessing(); ServerConnection.SetPort(Port); ServerConnection.SetServerHost(Host); ServerConnection.AudioCommandPacketReceived += conn_AudioCommandPacketReceived; ServerConnection.CommsIncomingPacketReceived += conn_CommsIncomingPacketReceived; ServerConnection.CommsOutgoingPacketReceived += conn_CommsOutgoingPacketReceived; ServerConnection.DestroyObjectPacketReceived += conn_DestroyObjectPacketReceived; ServerConnection.EngGridUpdatePacketReceived += conn_EngGridUpdatePacketReceived; ServerConnection.GameMessagePacketReceived += conn_GamesMessagePacketReceived; ServerConnection.IncomingAudioPacketReceived += conn_IncomingAudioPacketReceived; ServerConnection.ObjectStatusUpdatePacketReceived += conn_ObjectStatusUpdatePacketReceived; ServerConnection.PackageReceived += conn_PackageReceived; //This is not necessary (using only for logging) since all other events are subscribed to. ServerConnection.ShipActionPacketReceived += conn_ShipActionPacketReceived; ServerConnection.ShipAction2PacketReceived += conn_ShipActionPacket2Received; ServerConnection.ShipAction3PacketReceived += conn_ShipActionPacket3Received; ServerConnection.StationStatusPacketReceived += conn_StationStatusPacketReceived; ServerConnection.UndefinedPacketReceived += conn_UndefinedPacketReceived; ServerConnection.GameStartPacketReceived += conn_UnknownPacket1Received; ServerConnection.Unknown2PacketReceived += conn_UnknownPacket2Received; ServerConnection.VersionPacketReceived += conn_VersionPacketReceived; ServerConnection.WelcomePacketReceived += conn_WelcomePacketReceived; ServerConnection.StartServerConnection(); btnStartServer.Visibility = Visibility.Collapsed; btnStopServer.Visibility = Visibility.Visible; }
void StartServerConnection() { if (serverProcessor == null) { serverProcessor = new PacketProcessing(); serverProcessor.SetPort(ServerPort); serverProcessor.SetServerHost(ServerHost); Subscribe(serverProcessor); serverProcessor.StartServerConnection(); } else { if (proxyType == ProxyType.OneServerConnectionToOneClientConnection) { serverProcessor.StartServerConnection(); } } }