public void Connect(string host, int port, SslParameters sslParams) { this.m_stopWatch = new Stopwatch(); if (sslParams.useSsl) { this.Connection = new SslClientConnection(sslParams.bundleSettings) { OnlyOneSend = true }; } else { this.Connection = new ClientConnection <BattleNetPacket>(); } this.Connection.AddListener(this, null); this.Connection.AddConnectHandler(new ConnectHandler(this.OnConnectCallback)); this.Connection.AddDisconnectHandler(new DisconnectHandler(this.OnDisconnectCallback)); this.Connection.Connect(host, port); }
public void ConnectAurora(string address, int port, SslParameters sslParams) { this.m_logSource.LogInfo("Sending connection request to {0}:{1}", new object[] { address, port }); this.m_logSource.LogDebug("Aurora version is {0}", new object[] { this.GetVersion() }); this.m_rpcConnection = new RPCConnection(); this.m_connectionService.Id = 0u; this.m_rpcConnection.serviceHelper.AddImportedService(this.m_connectionService.Id, this.m_connectionService); this.m_rpcConnection.serviceHelper.AddExportedService(this.m_connectionService.Id, this.m_connectionService); this.m_rpcConnection.RegisterServiceMethodListener(this.m_connectionService.Id, 4u, new RPCContextDelegate(this.HandleForceDisconnectRequest)); this.m_rpcConnection.RegisterServiceMethodListener(this.m_connectionService.Id, 3u, new RPCContextDelegate(this.HandleEchoRequest)); this.m_rpcConnection.SetOnConnectHandler(new RPCConnection.OnConnectHandler(this.OnConnectHandlerCallback)); this.m_rpcConnection.SetOnDisconnectHandler(new RPCConnection.OnDisconectHandler(this.OnDisconectHandlerCallback)); this.m_rpcConnection.Connect(address, port, sslParams); this.SwitchToState(BattleNetCSharp.ConnectionState.InitRPC); }
public static bool Reset(bool internalMode, string userEmailAddress, string targetServer, int port, SslParameters sslParams, ClientInterface ci) { BattleNet.RequestCloseAurora(); BattleNet.s_impl = new BattleNetCSharp(); return(BattleNet.Init(internalMode, userEmailAddress, targetServer, port, sslParams, ci)); }
public static bool Init(bool internalMode, string userEmailAddress, string targetServer, int port, SslParameters sslParams, ClientInterface ci) { return(BattleNet.s_impl.Init(internalMode, userEmailAddress, targetServer, port, sslParams, ci)); }
public bool Init(bool internalMode, string userEmailAddress, string targetServer, int port, SslParameters sslParams, ClientInterface ci) { if (this.m_initialized) { return(true); } if (ci == null) { return(false); } this.m_stopwatch.Reset(); this.m_stopwatch.Start(); this.m_clientInterface = ci; this.m_auroraEnvironment = targetServer; this.m_auroraPort = ((port > 0) ? port : 1119); this.m_userEmailAddress = userEmailAddress; bool flag = false; try { string text; flag = UriUtils.GetHostAddress(targetServer, out text); } catch (Exception ex) { this.m_logSource.LogError("Exception within GetHostAddress: " + ex.Message); } if (flag) { this.m_initialized = true; this.ConnectAurora(targetServer, this.m_auroraPort, sslParams); } else { LogAdapter.Log(LogLevel.Fatal, "GLOBAL_ERROR_NETWORK_NO_CONNECTION"); } return(this.m_initialized); }