public void TestDataTransferMethods() { _dtpFactory = new DtpFactory(SendData); _dtpProcessor = new DtpProcessor(); _dtpProcessor.RegisterProcedure("TestMethod1", parameters => Trace.WriteLine("Parameterless method successfully executed")); _dtpProcessor.RegisterProcedure("TestMethod2", parameters => { Assert.AreEqual(parameters.GetInt32(0), 19); Trace.WriteLine("Method with int parameter successfully executed"); }); _dtpProcessor.RegisterProcedure("TestMethod3", parameters => { var result = parameters.GetValue <List <ClientInformation> >(0, typeof(OnlineClientInformation), typeof(OfflineClientInformation)); Assert.IsNotNull(result); Assert.AreEqual(result.Count, 3); Assert.AreEqual(result[1].Group, "test"); Trace.WriteLine("Method with complex parameter successfully executed"); }); Trace.WriteLine("Executing parameterless method"); _dtpFactory.ExecuteProcedure("TestMethod1"); Trace.WriteLine("Executing method with in parameter"); _dtpFactory.ExecuteProcedure("TestMethod2", 19); Trace.WriteLine("Executing method with complex parameter"); _dtpFactory.ExecuteProcedure("TestMethod3", new List <Type> { typeof(OnlineClientInformation), typeof(OfflineClientInformation) }, null, new List <ClientInformation> { new OnlineClientInformation(), new OfflineClientInformation { Group = "test" }, new OnlineClientInformation() }); }
public IConnection InitializeUdpHolePunchingConnection(out Guid connectionGuid) { var config = new NetPeerConfiguration("RemoteDesktopUdpHolePunching") { LocalAddress = _localIpAddress.Value }; config.EnableMessageType(NetIncomingMessageType.NatIntroductionSuccess); var netClient = new NetClient(config); netClient.InitializeSocket(); var isBlocking = netClient.Socket.Blocking; netClient.Socket.Blocking = true; var result = SessionTraversalUtilitiesForNAT.TestStun(SessionTraversalUtilitiesForNAT.GoogleStunServer, SessionTraversalUtilitiesForNAT.GoogleStunServerPort, netClient.Socket); netClient.Socket.Blocking = isBlocking; if (!SessionTraversalUtilitiesForNAT.IsHolePunchingPossible(result.NetType)) { throw new ConnectionException( "STUN server responded with: " + result.NetType + ". Hole punching not possible", ConnectionType.UdpHolePunching); } netClient.InitializeLoop(); UdpHolePunchingFeedback holePunchingFeedback; try { holePunchingFeedback = _dtpFactory.ExecuteFunction <UdpHolePunchingFeedback>("InitializeUdpPunchHolingConnection"); } catch (Exception ex) { throw new ConnectionException("(Client) " + ex.Message, ConnectionType.UdpHolePunching); } connectionGuid = holePunchingFeedback.ConnectionGuid; netClient.NatIntroduction(true, null, holePunchingFeedback.PublicEndPoint, "GARYFUCKINGWASHINGTON"); _dtpFactory.ExecuteProcedure("ConnectUdpPunchHolingConnection", connectionGuid, result.PublicEndPoint); netClient.WaitMessage(int.MaxValue); return(new ServerConnection()); }
public void GetActiveWindows(List <int> clients) { _dtpFactory.ExecuteProcedure("GetClientActiveWindowTitle", clients); }
public void RenameEntry(IFileExplorerEntry fileExplorerEntry, string newName) { LogService.Send(string.Format((string)Application.Current.Resources["RenameEntry"], fileExplorerEntry.Name, newName)); _dtpFactory.ExecuteProcedure("RenameEntry", fileExplorerEntry.ToEntryInfo(), newName); }