Exemplo n.º 1
0
		/// <summary>
		/// Create a ResultIsAvailable object from the value indicates if a domain is available, the Server object and exception object.
		/// </summary>
		/// <param name="isAvailable">Indicates if a domain if available for registration or not.</param>
		/// <param name="server">Whois server used.</param>
		/// <param name="exception">Exception if an error occurs.</param>
		public ResultIsAvailable(bool isAvailable, Server server, Exception exception) : base(server, exception)
		{
			_isAvailable = isAvailable;
		}
Exemplo n.º 2
0
		/// <summary>
		/// Add an Server object in the collection specifying the Server object.
		/// </summary>
		/// <param name="server">Server object to add.</param>
		/// <returns>Index of the list where the object has been added.</returns>
		public int Add(Server server)
		{
			return this.List.Add(server);
		}
Exemplo n.º 3
0
		/// <summary>
		/// Create a ResultIsAvailable object from the value indicates if a domain is available and the Server object.
		/// </summary>
		/// <param name="isAvailable">Indicates if a domain if available for registration or not.</param>
		/// <param name="server">Whois server used.</param>
		public ResultIsAvailable(bool isAvailable, Server server) : base(server)
		{
			_isAvailable = isAvailable;
		}
 /// <summary>
 /// Add a ResultIsAvailable object in the collection specifying isAvailable flag and the whois server used.
 /// </summary>
 /// <param name="isAvailable">Indicates if a domain is available for registration or not.</param>
 /// <param name="serverUsed">Whois server used.</param>
 /// <returns>Index of the list where the object has been added.</returns>
 public int Add(bool isAvailable, Server serverUsed)
 {
     return this.List.Add(new ResultIsAvailable(isAvailable,serverUsed));
 }
 /// <summary>
 /// Add a ResultIsAvailable object in the collection specifying isAvailable flag, the whois server used and the exception.
 /// </summary>
 /// <param name="isAvailable">Indicates if a domain is available for registration or not.</param>
 /// <param name="serverUsed">Whois server used.</param>
 /// <param name="exception">Exception if an error occurs.</param>
 /// <returns>Index of the list where the object has been added.</returns>
 public int Add(bool isAvailable, Server serverUsed, Exception exception)
 {
     return this.List.Add(new ResultIsAvailable(isAvailable,serverUsed,exception));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a RestultQuery object from result and Server object.
 /// </summary>
 /// <param name="result">Result string of the whois server.</param>
 /// <param name="server">Whois server used.</param>
 public ResultQuery(string result, Server server) : base(server)
 {
     _result = result;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a RestultQuery object from result, Server object and Exception object.
 /// </summary>
 /// <param name="result">Result string of the whois server.</param>
 /// <param name="server">Whois server used.</param>
 /// <param name="exception">Exception if an error occurs.</param>
 public ResultQuery(string result, Server server, Exception exception) : base(server,exception)
 {
     _result = result;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a Restult object from Server object and Exception object.
 /// </summary>
 /// <param name="server">Whois server used.</param>
 /// <param name="exception">Exception if an error occurs.</param>
 public Result(Server server, Exception exception)
 {
     _Init(server,exception);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a Result object from Server object and Exception object.
 /// </summary>
 /// <param name="server">Whois server used.</param>
 /// <param name="exception">Exception if an error occurs.</param>
 private void _Init(Server server, Exception exception)
 {
     _server = server;
     _exception = exception;
 }
 /// <summary>
 /// Add a ResultQuery object in the collection specifying result string, the whois server used and the exception.
 /// </summary>
 /// <param name="result">Result string of the whois server.</param>
 /// <param name="serverUsed">Whois server used.</param>
 /// <param name="exception">Exception if an error occurs.</param>
 /// <returns>Index of the list where the object has been added.</returns>
 public int Add(string result, Server serverUsed, Exception exception)
 {
     return this.List.Add(new ResultQuery(result, serverUsed, exception));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Creates a Result object from Server object.
 /// </summary>
 /// <param name="server">Whois server used.</param>
 public Result(Server server)
 {
     _Init(server,null);
 }
 /// <summary>
 /// Add a ResultQuery object in the collection specifying result string and the whois server used.
 /// </summary>
 /// <param name="result">Result string of the whois server.</param>
 /// <param name="serverUsed">Whois server used.</param>
 /// <returns>Index of the list where the object has been added.</returns>
 public int Add(string result, Server serverUsed)
 {
     return this.List.Add(new ResultQuery(result, serverUsed));
 }
Exemplo n.º 13
0
        /// <summary>
        /// Query a whois server specifying the specified Server object and domain to query asynchronously.
        /// </summary>
        /// <param name="server">Whois server.</param>
        /// <param name="domainToQuery">Domain to query.</param>
        /// <param name="callBack">Callback function.</param>
        /// <returns>IAsyncResult object that represents the result of the QueryAsync operation.</returns>
        /// <example>
        /// <code>
        /// [C#]
        /// 
        /// WhoIs whoIs = new WhoIs();    
        /// 
        /// Server server = new Server();
        /// server.Host = "whois.networksolutions.com";
        /// server.Port = 43;
        /// server.Domain = ".com";
        /// 
        /// IAsyncResult state = whoIs.QueryAsync(server,"activeup.com",new AsyncCallback(MyCallbackWhoIs));
        /// 
        /// public void MyCallbackWhoIs(IAsyncResult state)
        /// {
        ///        try
        ///        {
        ///            string result = whoIs.QueryAsyncResult(state);
        ///            Console.WriteLine(result);
        ///        }
        ///
        ///        catch(WhoisException we)
        ///        {
        ///            Console.WriteLine("WhoisException : " + we.Message);
        ///        }
        ///
        ///        catch(Exception ex)
        ///        {
        ///            Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
        ///        }
        /// }
        /// 
        /// [VB.NET] 
        /// 
        /// Private whoIs As whoIs = New whoIs()
        /// 
        ///    Dim server As New Server()
        ///    server.Host = "whois.networksolutions.com"
        ///    server.Port = 43
        ///    server.Domain = ".com"
        /// Dim state As IAsyncResult = whoIs.QueryAsync(server, New AsyncCallback(AddressOf MyCallbackWhoIs))
        /// 
        /// Public Sub MyCallbackWhoIs(ByVal state As IAsyncResult)
        ///
        ///        Try
        ///
        ///            Dim result As String = whoIs.QueryAsyncResult(state)
        ///            Console.WriteLine(result)
        ///
        ///        Catch we As WhoisException
        ///             Console.WriteLine("WhoisException : " + we.Message)
        ///
        ///        Catch ex As Exception
        ///             Console.WriteLine("An unhandled exception was thrown : " + ex.Message)
        ///
        ///        End Try
        ///
        ///    End Sub
        /// </code>
        /// </example> 
        public IAsyncResult QueryAsync(Server server, string domainToQuery,AsyncCallback callBack)
        {
            ServerCollection servers = new ServerCollection();
            servers.Add(server);

            _queryDelegate = new QueryDelegate(_Query);
            return _queryDelegate.BeginInvoke(servers,domainToQuery,false,callBack,null);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Query a whois server specifying the specified Server object and domain to query.
        /// </summary>
        /// <param name="server">Whois server.</param>
        /// <param name="domainToQuery">Domain to query.</param>
        /// <returns>Result of the whois server.</returns>
        /// <example>
        /// <code>
        /// [C#]
        /// 
        /// try
        /// {
        ///        Server server = new Server();
        ///        server.Host = "whois.networksolutions.com";
        ///        server.Port = 43;
        ///        server.Domain = ".com";
        /// 
        ///        WhoIs whoIs = new WhoIs();
        ///        string result = whoIs.Query(server,"activeup.com");
        ///        Console.WriteLine(result);
        ///    }
        /// 
        /// catch(WhoisException we)
        ///    {
        ///        Console.WriteLine("WhoisException : " + we.Message);
        ///    }
        ///
        ///    catch(Exception ex)
        ///    {
        ///        Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
        ///    }
        ///    
        /// [VB.NET]
        /// 
        /// Try
        ///
        ///        Dim server As New Server()
        ///        server.Host = "whois.networksolutions.com"
        ///        server.Port = 43
        ///        server.Domain = ".com"
        ///
        ///        Dim whoIs As New WhoIs()
        ///        Dim result As String = whoIs.Query("whois.networksolutions.com",43,"activeup.com")
        ///        Console.WriteLine(result)
        ///
        ///    Catch we as WhoisException
        ///        Console.WriteLine("WhoisException : " + we.Message)
        ///
        ///    Catch ex As Exception
        ///        Console.WriteLine("An unhandled exception was thrown : " + ex.Message)
        ///        
        ///    End Try
        /// </code>
        /// </example>
        public string Query(Server server, string domainToQuery)
        {
            ServerCollection servers = new ServerCollection();
            servers.Add(server);

            return _Query(servers,domainToQuery,false);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Checks to see if a domain is available for registration asynchronously sing the specified Server object and  domain to query.
        /// </summary>
        /// <param name="server">Whois server.</param>
        /// <param name="domainToQuery">Domain to query.</param>
        /// <param name="callBack">Callback function.</param>
        /// <returns>IAsyncResult object that represents the result of the IsAvailableAsync operation.</returns>
        /// <example>
        /// <code>
        /// [C#]
        /// 
        /// Server server = new Server();
        /// server.Host = "whois.networksolutions.com";
        /// server.Port = 43;
        /// server.Domain = ".com";
        /// server.NoMatch = "no match";
        /// 
        /// WhoIs whoIs = new WhoIs();
        /// IAsyncResult state = whoIs.IsAvailableAsync(server,"activeup.com",new AsyncCallback(MyCallbackIsAvailable));
        /// 
        /// public void MyCallbackIsAvailable(IAsyncResult state)
        /// {
        ///        try
        ///        {
        ///            bool result = whoIs.IsAvailableAsyncResult(state);
        ///            if (result == true)
        ///                Console.WriteLine("The domain is available for registration.");
        ///            else
        ///                Console.WriteLine("The domain is NOT available for registration.");
        ///            
        ///        }
        ///
        ///        catch(WhoisException we)
        ///        {
        ///            Console.WriteLine("WhoisException : " + we.Message);
        ///        }
        ///
        ///        catch(Exception ex)
        ///        {
        ///            Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
        ///        }
        /// }
        /// 
        /// [VB.NET] 
        /// 
        /// Private whoIs As whoIs = New whoIs()
        /// 
         ///    Dim server As New Server()
        ///    server.Host = "whois.networksolutions.com"
        ///    server.Port = 43
        ///    server.Domain = ".com"
        ///    server.NoMatch = "no match"
        /// 
        /// Dim state As IAsyncResult = whoIs.IsAvailableAsync(server,"activeup.com", New AsyncCallback(AddressOf MyCallbackIsAvailable))
        /// 
        /// Public Sub MyCallbackIsAvailable(ByVal state As IAsyncResult)
        ///
        ///        Try
        ///            Dim result As Boolean = whoIs.IsAvailableAsyncResult(state)
        ///            If (result = True) Then
        ///                Console.WriteLine("The domain is available for registration.")
        ///            Else
        ///                Console.WriteLine("The domain is NOT available for registration.")
        ///            End If
        ///
        ///        Catch we As WhoisException
        ///            Console.WriteLine("WhoisException : " + we.Message)
        ///
        ///        Catch ex As Exception
        ///            Console.WriteLine("An unhandled exception was thrown : " + ex.Message)
        ///
        ///        End Try
        ///
        ///    End Sub
        /// </code>
        /// </example>
        public IAsyncResult IsAvailableAsync(Server server, string domainToQuery,AsyncCallback callBack)
        {
            ServerCollection servers = new ServerCollection();
            servers.Add(server);

            _isAvailableDelegate = new IsAvailableDelegate(_IsAvailable);
            return _isAvailableDelegate.BeginInvoke(servers,domainToQuery,callBack,null);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Checks if a domain is available for registration specifying the specified Server object and  domain to query.
        /// </summary>
        /// <param name="server">Whois server.</param>
        /// <param name="domainToQuery">Domain to query.</param>
        /// <returns>True if the domain is available for registration. False if the domain name is not available for registration and is already taken by someone else.</returns>
        /// <example>
        /// <code>
        /// [C#]
        /// 
        /// try
        /// {
        ///        Server server = new Server();
        ///        server.Host = "";
        ///        server.Port = 43;
        ///        server.Domain = ".com";
        ///        server.NoMatch = "no match";
        /// 
        ///        WhoIs whoIs = new WhoIs();
        ///        bool result = whoIs.IsAvailable(server,"activeup.com");
        ///        if (result == true)
        ///            Console.WriteLine("The domain is available for registration.");
        ///        else
        ///            Console.WriteLine("The domain is NOT available for registration.");
        ///    }
        ///    
        /// catch(WhoisException we)
        ///    {
        ///        Console.WriteLine("WhoisException : " + we.Message);
        ///    }
        ///
        ///    catch(Exception ex)
        ///    {
        ///        Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
        ///    }
        ///        
        ///    [VB.NET]
        ///    
        ///    Try
        ///    
        ///        Dim server As New Server()
        ///        server.Host = "whois.networksolutions.com"
        ///        server.Port = 43
        ///        server.Domain = ".com"
        ///        server.NoMatch = "no match"
        ///
        ///        Dim whoIs As New WhoIs()
        ///        Dim result As Boolean = whoIs.IsAvailable(server, "activeup.com")
        ///        If (result = True) Then
        ///            Console.WriteLine("The domain is available for registration.")
        ///        Else
        ///            Console.WriteLine("The domain is NOT available for registration.")
        ///        End If
        ///
        ///    Catch we As WhoisException
        ///         Console.WriteLine("WhoisException : " + we.Message)
        ///
        ///    Catch ex As Exception
        ///         Console.WriteLine("An unhandled exception was thrown : " + ex.Message)
        ///
        ///    End Try
        /// </code>
        /// </example>
        public bool IsAvailable(Server server, string domainToQuery)
        {
            ServerCollection servers = new ServerCollection();
            servers.Add(server);

            return _IsAvailable(servers,domainToQuery);
        }