public void SetNetworkData(object data) { HServerInformation server = (HServerInformation)data; this.server = server; if (server != null) { this.Guid = server.Guid; this.Name = server.Name; State = ConnectionState.Connected; } else { State = ConnectionState.Disconnected; } }
public async Task ConnectAsync(string ip) { await CancelScanningAsync(); Guid guid = await client.ConnectAsync(new HostName(ip), SHUB_PORT); // Connection timeout if (guid == default(Guid)) { if (ConnectionTimeout != null) { ConnectionTimeout(this, ip); } return; } if (NewProfile != null) { HServerInformation serverInf = client.GetServer(guid); TClientProfile profile = new TClientProfile(serverInf, serverInf.IP); profile.State = ConnectionState.Connected; NewProfile(this, profile); } }
public TClientProfile(HServerInformation server, string ip = "127.0.0.1") { LastIPAddress = ip; SetNetworkData(server); }