private async void CheckDeviceCount(ButtplugService aService, int aExpectedCount) { var deviceListMsg = await aService.SendMessage(new RequestDeviceList()); Assert.True(deviceListMsg is DeviceList); Assert.Equal(((DeviceList)deviceListMsg).Devices.Length, aExpectedCount); }
public void TestLicenseFileLoading() { var license = ButtplugService.GetLicense(); Assert.Contains("B******g is covered under the following BSD 3-Clause License", license); Assert.Contains("NJsonSchema (https://github.com/RSuter/NJsonSchema) is covered under the", license); }
public async void RequestServerInfoTest() { var s = new ButtplugService("TestClient", 100); var results = new List <ButtplugMessage> { await s.SendMessage(new RequestServerInfo("TestClient")) }; results.AddRange(await s.SendMessage("[{\"RequestServerInfo\":{\"Id\":1, \"ClientName\":\"TestClient\"}}]")); foreach (var reply in results) { ServerInfo r; try { r = (ServerInfo)reply; } catch (InvalidCastException) { Assert.True(reply is ServerInfo); continue; } Assert.True(r.MajorVersion == Assembly.GetAssembly(typeof(ServerInfo)).GetName().Version.Major); Assert.True(r.MinorVersion == Assembly.GetAssembly(typeof(ServerInfo)).GetName().Version.Minor); Assert.True(r.BuildVersion == Assembly.GetAssembly(typeof(ServerInfo)).GetName().Version.Build); } }
public async void NonRequestServerInfoFirstTest() { var s = new ButtplugService("TestClient", 100); Assert.True(await s.SendMessage(new Core.Messages.Test("Test")) is Error); Assert.True(await s.SendMessage(new RequestServerInfo("TestClient")) is ServerInfo); Assert.True(await s.SendMessage(new Core.Messages.Test("Test")) is Core.Messages.Test); }
private ButtplugService InitializeButtplugServer(string aServerName, uint aMaxPingTime) { // Set up internal services var bpServer = new ButtplugService(aServerName, aMaxPingTime); if (!(Environment.OSVersion is null)) { _guiLog.Info($"Windows Version: {Environment.OSVersion.VersionString}"); }
public KiirooEmulatorPanel(ButtplugService aBpService) { _bpServer = aBpService; _bpServer.SendMessage(new RequestServerInfo("Kiiroo Emulator")).Wait(); _devices = new DeviceList(); InitializeComponent(); DeviceListBox.ItemsSource = _devices; _bpServer.MessageReceived += OnMessageReceived; _kiirooEmulator = new KiirooPlatformEmulator(); _kiirooEmulator.OnKiirooPlatformEvent += HandleKiirooPlatformMessage; _kiirooEmulator.OnException += HandleKiirooPlatformMessage; _translator = new KiirooMessageTranslator(); _translator.VibrateEvent += OnVibrateEvent; DeviceListBox.SelectionMode = SelectionMode.Multiple; DeviceListBox.SelectionChanged += SelectionChangedHandler; _ops = new List <DispatcherOperation>(); }
public LicenseView() { InitializeComponent(); LicenseText.Text = ButtplugService.GetLicense(); }