public override bool Start() { Model = DsModel.DS4; // skip repairing if disabled in global configuration if (!GlobalConfiguration.Instance.Repair) { return(base.Start()); } var transfered = 0; var hostMac = HostAddress.GetAddressBytes(); byte[] buffer = { 0x13, hostMac[5], hostMac[4], hostMac[3], hostMac[2], hostMac[1], hostMac[0], 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; Buffer.BlockCopy(GlobalConfiguration.Instance.BdLink, 0, buffer, 7, GlobalConfiguration.Instance.BdLink.Length); if (SendTransfer(UsbHidRequestType.HostToDevice, UsbHidRequest.SetReport, 0x0313, buffer, ref transfered)) { Log.DebugFormat("++ Repaired DS4 [{0}] Link Key For BTH Dongle [{1}]", DeviceAddress.AsFriendlyName(), HostAddress.AsFriendlyName()); } else { Log.DebugFormat("++ Repair DS4 [{0}] Link Key For BTH Dongle [{1}] Failed!", DeviceAddress.AsFriendlyName(), HostAddress.AsFriendlyName()); } return(base.Start()); }
static NetworkInterface GetInterfaceForHost(string Host) { if (BuildHostPlatform.Current.Platform == UnrealTargetPlatform.Win64) { IPHostEntry HostEntry = Dns.GetHostEntry(Host); foreach (IPAddress HostAddress in HostEntry.AddressList) { int InterfaceIdx = 0; if (GetBestInterface(BitConverter.ToUInt32(HostAddress.GetAddressBytes(), 0), ref InterfaceIdx) == 0) { foreach (NetworkInterface Interface in NetworkInterface.GetAllNetworkInterfaces()) { IPv4InterfaceProperties Properties = Interface.GetIPProperties().GetIPv4Properties(); if (Properties.Index == InterfaceIdx) { return(Interface); } } } } } return(null); }