public static LobbyWindow lanGame(UserAccount account, ILobbyGUI gui) { DiscoveryClient dc = new DiscoveryClient(new UdpDiscoveryEndpoint()); FindCriteria fc = new FindCriteria(typeof(IDiscoveryTest)); fc.Duration = TimeSpan.FromSeconds(5); FindResponse fr = dc.Find(fc); if (fr.Endpoints.Count > 0) { ip = fr.Endpoints[0].Address.Uri.Host.ToString(); } else { string HostName = System.Net.Dns.GetHostName(); System.Net.IPHostEntry hostInfo = System.Net.Dns.GetHostByName(HostName); string IpAdresse = hostInfo.AddressList[0].ToString(); ip = IpAdresse; Server server = new Server(new WCFTCPServiceFactory(),ip); server.run(); } factory = new WCFTCPConnectionFactory(); lobbyWindow = new LobbyWindow(account, gui, factory); factory.connectToLobby(ip, lobbyWindow); return lobbyWindow; }
public static LobbyWindow onlineGame(UserAccount account, ILobbyGUI gui) { ip = "145.93.27.6"; factory = new WCFHTTPConnectionFactory(); lobbyWindow = new LobbyWindow(account, gui, factory); factory.connectToLobby(ip, lobbyWindow); return lobbyWindow; }
public ILobby connectToLobby(string uri, LobbyWindow lobbyWindow) { uri = HTTP_CONN_STR + uri + "/" + LOBBY_NAME; DuplexChannelFactory<ILobby> httpDuplexFactory = new DuplexChannelFactory<ILobby>( new LobbyCallback(lobbyWindow), new WSDualHttpBinding(WSDualHttpSecurityMode.Message), new EndpointAddress( uri)); return httpDuplexFactory.CreateChannel(); }
public ILobby connectToLobby(string uri, LobbyWindow lobbyWindow) { uri = TCP_CONN_STR + uri + "/" + LOBBY_NAME; DuplexChannelFactory<ILobby> tcpDuplexFactory = new DuplexChannelFactory<ILobby>( new LobbyCallback(lobbyWindow), new NetTcpBinding(SecurityMode.None), new EndpointAddress( uri)); return tcpDuplexFactory.CreateChannel(); }
public void register(LobbyWindow window) { lobby = window; }
public LobbyCallback(LobbyWindow lobbyWindow) { this.lobbyWindow = lobbyWindow; }
public TestGUI() { UserAccount user = new UserAccount("testUser", 0); lobbyWindow = new LobbyWindow(user, this, new WCFTCPConnectionFactory()); messageUpdated = 0; logUpdated = 0; }