//Hide or show the media controller async Task MediaControllerHideShow(bool forceShow) { try { //Check if socket server is running if (vArnoldVinkSockets == null) { Debug.WriteLine("The socket server is not running."); return; } //Prepare socket data SocketSendContainer socketSend = new SocketSendContainer(); socketSend.SourceIp = vArnoldVinkSockets.vSocketServerIp; socketSend.SourcePort = vArnoldVinkSockets.vSocketServerPort; if (forceShow) { socketSend.Object = "MediaShow"; } else { socketSend.Object = "MediaHideShow"; } //Request controller status 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 { } }
//Send the notification status public async Task Notification_Send_Status(string targetIcon, string targetText) { try { //Check if socket server is running if (vArnoldVinkSockets == null) { Debug.WriteLine("The socket server is not running."); return; } //Create notification class NotificationDetails NotificationDetails = new NotificationDetails(); NotificationDetails.Icon = targetIcon; NotificationDetails.Text = targetText; //Prepare socket data SocketSendContainer socketSend = new SocketSendContainer(); socketSend.SourceIp = vArnoldVinkSockets.vSocketServerIp; socketSend.SourcePort = vArnoldVinkSockets.vSocketServerPort; socketSend.Object = NotificationDetails; //Request controller status 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 { } }
//Close the Fps Overlayer async Task CloseFpsOverlayer() { try { await Notification_Send_Status("Fps", "Hiding Fps Overlayer"); Debug.WriteLine("Closing Fps Overlayer"); //Check if socket server is running if (vArnoldVinkSockets == null) { Debug.WriteLine("The socket server is not running."); return; } //Prepare socket data SocketSendContainer socketSend = new SocketSendContainer(); socketSend.SourceIp = vArnoldVinkSockets.vSocketServerIp; socketSend.SourcePort = vArnoldVinkSockets.vSocketServerPort; socketSend.Object = "ApplicationExit"; byte[] SerializedData = SerializeObjectToBytes(socketSend); //Send socket data TcpClient tcpClient = await vArnoldVinkSockets.TcpClientCheckCreateConnect(vArnoldVinkSockets.vSocketServerIp, vArnoldVinkSockets.vSocketServerPort + 2, vArnoldVinkSockets.vSocketTimeout); await vArnoldVinkSockets.TcpClientSendBytes(tcpClient, SerializedData, vArnoldVinkSockets.vSocketTimeout, false); } catch { } }
//Notify - DirectXInput setting changed public async Task NotifyDirectXInputSettingChanged(string settingName) { try { //Check if socket server is running if (vArnoldVinkSockets == null) { Debug.WriteLine("The socket server is not running."); return; } //Prepare socket data SocketSendContainer socketSend = new SocketSendContainer(); socketSend.SourceIp = vArnoldVinkSockets.vSocketServerIp; socketSend.SourcePort = vArnoldVinkSockets.vSocketServerPort; socketSend.Object = "SettingChanged" + settingName; byte[] SerializedData = SerializeObjectToBytes(socketSend); //Send socket data TcpClient tcpClient = await vArnoldVinkSockets.TcpClientCheckCreateConnect(vArnoldVinkSockets.vSocketServerIp, vArnoldVinkSockets.vSocketServerPort - 2, vArnoldVinkSockets.vSocketTimeout); await vArnoldVinkSockets.TcpClientSendBytes(tcpClient, SerializedData, vArnoldVinkSockets.vSocketTimeout, false); } catch { } }
//Show CtrlUI when not focused async Task ShowCtrlUI() { try { //Check if socket server is running if (vArnoldVinkSockets == null) { Debug.WriteLine("The socket server is not running."); return; } //Prepare socket data SocketSendContainer socketSend = new SocketSendContainer(); socketSend.SourceIp = vArnoldVinkSockets.vSocketServerIp; socketSend.SourcePort = vArnoldVinkSockets.vSocketServerPort; socketSend.Object = "AppWindowHideShow"; 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 { } }
private static async Task ShowCtrlUI() { try { //Check if socket server is running if (vArnoldVinkSockets == null) { Debug.WriteLine("The socket server is not running."); return; } Debug.WriteLine("Showing CtrlUI."); //Show notification NotificationDetails notificationDetails = new NotificationDetails(); notificationDetails.Icon = "AppLaunch"; notificationDetails.Text = "Showing CtrlUI"; await App.vWindowOverlay.Notification_Show_Status(notificationDetails); //Prepare socket data SocketSendContainer socketSend = new SocketSendContainer(); socketSend.SourceIp = vArnoldVinkSockets.vSocketServerIp; socketSend.SourcePort = vArnoldVinkSockets.vSocketServerPort; socketSend.Object = "AppWindowHideShow"; byte[] SerializedData = SerializeObjectToBytes(socketSend); //Send socket data TcpClient tcpClient = await vArnoldVinkSockets.TcpClientCheckCreateConnect(vArnoldVinkSockets.vSocketServerIp, vArnoldVinkSockets.vSocketServerPort - 1, vArnoldVinkSockets.vSocketTimeout); await vArnoldVinkSockets.TcpClientSendBytesServer(tcpClient, SerializedData, vArnoldVinkSockets.vSocketTimeout, false); } catch { } }
//Send controller output to CtrlUI async Task OutputAppCtrlUI(ControllerStatus Controller) { try { if (GetSystemTicksMs() >= Controller.Delay_CtrlUIOutput) { //Check if socket server is running if (vArnoldVinkSockets == null) { Debug.WriteLine("The socket server is not running."); return; } //Prepare socket data SocketSendContainer socketSend = new SocketSendContainer(); socketSend.SourceIp = vArnoldVinkSockets.vSocketServerIp; socketSend.SourcePort = vArnoldVinkSockets.vSocketServerPort; socketSend.Object = Controller.InputCurrent; 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); //Update delay time Controller.Delay_CtrlUIOutput = GetSystemTicksMs() + vControllerDelayNanoTicks; } } catch { } }
//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.TcpClientSendBytesServer(tcpClient, SerializedData, vArnoldVinkSockets.vSocketTimeout, false); } catch { } }
async Task SendControllerStatusDetailsList(SocketSendContainer deserializedBytes) { try { //Check if socket server is running if (vArnoldVinkSockets == null) { Debug.WriteLine("The socket server is not running."); return; } //List controller status List <ControllerStatusDetails> controllerStatusDetailsList = new List <ControllerStatusDetails>(); //Gather controller status ControllerStatusDetails controllerStatus0 = new ControllerStatusDetails(vController0.NumberId); controllerStatus0.Activated = vController0.Activated; controllerStatus0.Connected = vController0.Connected(); controllerStatus0.BatteryCurrent = vController0.BatteryCurrent; controllerStatusDetailsList.Add(controllerStatus0); ControllerStatusDetails controllerStatus1 = new ControllerStatusDetails(vController1.NumberId); controllerStatus1.Activated = vController1.Activated; controllerStatus1.Connected = vController1.Connected(); controllerStatus1.BatteryCurrent = vController1.BatteryCurrent; controllerStatusDetailsList.Add(controllerStatus1); ControllerStatusDetails controllerStatus2 = new ControllerStatusDetails(vController2.NumberId); controllerStatus2.Activated = vController2.Activated; controllerStatus2.Connected = vController2.Connected(); controllerStatus2.BatteryCurrent = vController2.BatteryCurrent; controllerStatusDetailsList.Add(controllerStatus2); ControllerStatusDetails controllerStatus3 = new ControllerStatusDetails(vController3.NumberId); controllerStatus3.Activated = vController3.Activated; controllerStatus3.Connected = vController3.Connected(); controllerStatus3.BatteryCurrent = vController3.BatteryCurrent; controllerStatusDetailsList.Add(controllerStatus3); //Prepare socket data SocketSendContainer socketSend = new SocketSendContainer(); socketSend.SourceIp = vArnoldVinkSockets.vSocketServerIp; socketSend.SourcePort = vArnoldVinkSockets.vSocketServerPort; socketSend.Object = controllerStatusDetailsList; byte[] SendBytes = SerializeObjectToBytes(socketSend); //Send socket data TcpClient socketClient = await vArnoldVinkSockets.TcpClientCheckCreateConnect(deserializedBytes.SourceIp, deserializedBytes.SourcePort, vArnoldVinkSockets.vSocketTimeout); await vArnoldVinkSockets.TcpClientSendBytes(socketClient, SendBytes, vArnoldVinkSockets.vSocketTimeout, false); } catch { } }