/// <summary> /// Secure SMTP Client constructor for plain text authorization /// </summary> /// <param name="ConnMethod">Connect method (secure/Unsecure)</param> /// <param name="Host">Email server host name</param> /// <param name="UserName">User name (host login id)</param> /// <param name="UserPassword">User password (host login password)</param> public SecureSmtpClient ( ConnectMethod ConnMethod, string Host, string UserName, string UserPassword ) { // test all required values if (string.IsNullOrWhiteSpace(Host)) { throw new ApplicationException("Host name is missing"); } if (string.IsNullOrWhiteSpace(UserName)) { throw new ApplicationException("User name is missing"); } if (string.IsNullOrWhiteSpace(UserPassword)) { throw new ApplicationException("User password is missing"); } // save arguments this.ConnMethod = ConnMethod; this.Host = Host; this.UserName = UserName; this.UserPassword = UserPassword; AuthMethod = Authentication.PlainText; if (ConnMethod == ConnectMethod.Unsecure) { Port = 587; } return; }
/// <summary> /// Secure SMTP Client constructor for OAuth2 authorization /// </summary> /// <param name="Host">Email server host name</param> /// <param name="UserName">User name (host login id)</param> /// <param name="OAuth2">Class implementing IOAuth2 interface</param> public SecureSmtpClient ( string Host, string UserName, IOAuth2 OAuth2 ) { // test all required values if (string.IsNullOrWhiteSpace(Host)) { throw new ApplicationException("Host name is missing"); } if (string.IsNullOrWhiteSpace(UserName)) { throw new ApplicationException("User name is missing"); } if (OAuth2 == null) { throw new ApplicationException("Authorization value is missing"); } // save arguments this.Host = Host; this.UserName = UserName; this.OAuth2 = OAuth2; AuthMethod = Authentication.OAuth2; ConnMethod = ConnectMethod.Secure; return; }
public async Task Start(ConnectMethod connectMethod = ConnectMethod.Tap, string displayAdvertiseName = null) { Reset(); connectMode = connectMethod; if (!string.IsNullOrEmpty(displayAdvertiseName)) { PeerFinder.DisplayName = displayAdvertiseName; } try { PeerFinder.Start(); } catch (Exception) { Debug.WriteLine("Peerfinder error"); } // Enable browse if (connectMode == ConnectMethod.Browse) { if (ConnectCrossPlatform) { await InitBrowseWpToWin(); } await PeerFinder.FindAllPeersAsync().AsTask().ContinueWith(p => { if (!p.IsFaulted) { FirePeersFound(p.Result); } }); } }
/// <summary> /// Secure SMTP Client constructor for plain text authorization /// </summary> /// <param name="connMethod">Connect method (secure/Unsecure)</param> /// <param name="host">Email server host name</param> /// <param name="userName">User name (host login id)</param> /// <param name="userPassword">User password (host login password)</param> public SecureSmtpClient(ConnectMethod connMethod, string host, string userName, string userPassword) { // test all required values if (string.IsNullOrWhiteSpace(host)) { throw new ApplicationException("Host name is missing"); } if (string.IsNullOrWhiteSpace(userName)) { throw new ApplicationException("User name is missing"); } if (string.IsNullOrWhiteSpace(userPassword)) { throw new ApplicationException("User password is missing"); } // save arguments this._connMethod = connMethod; this._host = host; this._userName = userName; this._userPassword = userPassword; _authMethod = Authentication.PlainText; if (connMethod == ConnectMethod.Unsecure) { _port = 587; } return; }
public ServerSocket(string _ipAddressPort, ConnectMethod _connect = null, DisconnectMethod _disconnect = null, DecodePacketMethod _decodePacket = null, int _bufferSize = 1024, int _backLog = 100) { port = int.Parse(_ipAddressPort.Split(new char[] { ':' })[1]); connectMethod = _connect; disconnectMethod = _disconnect; decodePacketMethod = _decodePacket; bufferSize = _bufferSize; backLog = _backLog; }
public ServerSocket(int _port, ConnectMethod _connect = null, DisconnectMethod _disconnect = null, DecodePacketMethod _decodePacket = null, int _bufferSize = 1024, int _backLog = 100) { port = _port; connectMethod = _connect; disconnectMethod = _disconnect; decodePacketMethod = _decodePacket; bufferSize = _bufferSize; backLog = _backLog; }
public ClientSocket(string _ipAddressPort, ConnectMethod _connect = null, DisconnectMethod _disconnect = null, DecodePacketMethod _decodePacket = null, int _bufferSize = 1024) { ipAddress = _ipAddressPort.Split(new char[] { ':' })[0]; port = int.Parse(_ipAddressPort.Split(new char[] { ':' })[1]); connectMethod = _connect; disconnectMethod = _disconnect; decodePacketMethod = _decodePacket; bufferSize = _bufferSize; buffer = new byte[_bufferSize]; }
public ClientSocket(string _ipAddress, int _port, ConnectMethod _connect = null, DisconnectMethod _disconnect = null, DecodePacketMethod _decodePacket = null, int _bufferSize = 1024) { ipAddress = _ipAddress; port = _port; connectMethod = _connect; disconnectMethod = _disconnect; decodePacketMethod = _decodePacket; bufferSize = _bufferSize; buffer = new byte[_bufferSize]; }
/// <summary> /// Secure SMTP Client constructor for OAuth2 authorization /// </summary> /// <param name="host">Email server host name</param> /// <param name="userName">User name (host login id)</param> /// <param name="oAuth2">Class implementing IOAuth2 interface</param> public SecureSmtpClient(string host, string userName, IOAuth2 oAuth2) { // test all required values if (string.IsNullOrWhiteSpace(host)) { throw new ApplicationException("Host name is missing"); } if (string.IsNullOrWhiteSpace(userName)) { throw new ApplicationException("User name is missing"); } // save arguments this._host = host; this._userName = userName; this._oAuth2 = oAuth2 ?? throw new ApplicationException("Authorization value is missing"); _authMethod = Authentication.OAuth2; _connMethod = ConnectMethod.Secure; return; }
public void Connect(string cluster, ConnectMethod method) { lock (SyncRoot) { Instance.Connect(cluster, method); } }
public Task ConnectServiceAsClientAsync(IHpcContext hpcContext, ServiceAsClientIdentityProvider identityProvider, string userName, string password, ConnectMethod method) { lock (SyncRoot) { return(Instance.ConnectServiceAsClientAsync(hpcContext, identityProvider, userName, password, method)); } }
public Task ConnectAsync(SchedulerConnectionContext context, CancellationToken token, ConnectMethod method) { lock (SyncRoot) { return(Instance.ConnectAsync(context, token, method)); } }
public ServerList(ConnectMethod method) { Console.Clear(); try { IPEndPoint trackerIP = new IPEndPoint(Dns.GetHostAddresses("tracker.timedashgame.com")[0], 1260); UdpClient client = new UdpClient(); client.Client.ReceiveTimeout = 2000; client.Connect(trackerIP); client.Send(new byte[] { 0 }, 1); MessageBuffer msg = new MessageBuffer(client.Receive(ref trackerIP)); int nmbr = msg.ReadInt(); if (nmbr > 0) { Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Choose a server:"); for (int i = 0; i < nmbr; i++) { serverList.Add(new Server(msg.ReadString())); serverList[i].FetchInfo(); Console.ForegroundColor = ConsoleColor.Gray; Console.Write("({0}) ", i); serverList[i].Print(); } } else { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("No servers online. Why not start one?"); } } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Couldn't connect to server tracker :("); } Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(); if (serverList.Count > 1) { Console.WriteLine("(0-{0}) Connect to server", serverList.Count - 1); } if (serverList.Count == 1) { Console.WriteLine("(0) Connect to server", serverList.Count); } Console.WriteLine("(C) Connect to custom IP"); string ip = null; while (ip == null) { try { char c = Console.ReadKey().KeyChar; if (c == 'c' || c == 'C') { Console.Clear(); Console.Write("Connect to: "); ip = Console.ReadLine(); } else { int index = int.Parse(c.ToString()); ip = serverList[index].ip; } } catch (Exception e) { Console.WriteLine("What?"); } } method(ip); }