/// <summary> /// Initializes a web session /// </summary> /// <param name="Socket">The socket to use (default TCP port for HTTP is 80)</param> public HTTP_Client(SimpleSocket Socket) { this._Socket = Socket; this.Accept = "*/*"; this.AcceptLanguage = "en"; // What kind of device do we run on? string[] SocketProvider = Socket.ToString().Split(new char[] { '.' }); string[] Client = this.ToString().Split(new char[] { '.' }); // User Agent this.UserAgent = "NETMFToolbox/0.1 (textmode; " + Tools.HardwareProvider + "; " + SocketProvider[SocketProvider.Length - 1] + "; " + Client[Client.Length - 1] + ")"; // No referrer yet this.Referrer = ""; }
/// <summary> /// Connects to an IRC server /// </summary> /// <param name="Socket">The socket to use</param> /// <param name="Nickname">Nickname</param> /// <param name="Username">Username (optional)</param> /// <param name="Fullname">Full name (optional)</param> /// <param name="Password">Password to connect to the server (optional)</param> public IRC_Client(SimpleSocket Socket, string Nickname, string Username = "", string Fullname = "", string Password = "") { // What kind of device do we run on? string[] SocketProvider = Socket.ToString().Split(new char[] { '.' }); string[] Client = this.ToString().Split(new char[] { '.' }); // Version this._ClientVersion = "NETMFToolbox/0.1 (" + Tools.HardwareProvider + "; " + SocketProvider[SocketProvider.Length - 1] + "; " + Client[Client.Length - 1] + ")"; // Stores all fields this._Socket = Socket; this._Nickname = Nickname; this._Username = (Username == "") ? Nickname : Username; this._Fullname = (Fullname == "") ? this._ClientVersion : Fullname; this._Password = Password; this._ServerName = Socket.Hostname; // Configures the socket this._Socket.LineEnding = "\n"; // Creates a new background thread this._LoopThread = new Thread(new ThreadStart(this._Loop)); }