//Notify - Fps Overlayer keypad size changed public static async Task NotifyFpsOverlayerKeypadSizeChanged(int keypadHeight) { try { //Check if socket server is running if (vArnoldVinkSockets == null) { Debug.WriteLine("The socket server is not running."); return; } //Set keypad size class KeypadSize keypadSize = new KeypadSize(); keypadSize.Height = keypadHeight; //Prepare socket data SocketSendContainer socketSend = new SocketSendContainer(); socketSend.SourceIp = vArnoldVinkSockets.vSocketServerIp; socketSend.SourcePort = vArnoldVinkSockets.vSocketServerPort; socketSend.Object = keypadSize; byte[] SerializedData = SerializeObjectToBytes(socketSend); //Send socket data TcpClient tcpClient = await vArnoldVinkSockets.TcpClientCheckCreateConnect(vArnoldVinkSockets.vSocketServerIp, vArnoldVinkSockets.vSocketServerPort + 1, vArnoldVinkSockets.vSocketTimeout); await vArnoldVinkSockets.TcpClientSendBytes(tcpClient, SerializedData, vArnoldVinkSockets.vSocketTimeout, false); } catch { } }
async Task ReceivedSocketHandlerThread(TcpClient tcpClient, byte[] receivedBytes) { try { //Deserialize the received bytes if (!DeserializeBytesToObject(receivedBytes, out SocketSendContainer deserializedBytes)) { return; } //Get the source server ip and port //Debug.WriteLine("Received socket from: " + DeserializedBytes.SourceIp + ":" + DeserializedBytes.SourcePort); //Check what kind of object was received if (deserializedBytes.Object is string) { string receivedString = (string)deserializedBytes.Object; Debug.WriteLine("Received string: " + receivedString); if (receivedString == "ApplicationExit") { await Application_Exit(); } else if (receivedString == "SettingChangedDisplayMonitor") { vConfigurationCtrlUI = Settings_Load_CtrlUI(); UpdateWindowPosition(); } } else if (deserializedBytes.Object is KeypadSize) { KeypadSize receivedKeypadSize = (KeypadSize)deserializedBytes.Object; //Set the window keypad margin vKeypadBottomMargin = receivedKeypadSize.Height; //Update the fps overlay position UpdateFpsOverlayPosition(vTargetProcess.Name); } } catch { } }