namespace ChadSoft.Utils.Pingy.Pingers
{
using System;
///
/// An implementation of an IPinger that pings URI locations
///
public abstract class UriPinger : IPinger
{
#region Properties
private readonly Uri _Location;
///
/// Gets the location to ping
///
/// The location to ping.
public Uri Location
{
get { return _Location; }
}
///
/// Gets the path to be pung.
///
/// The path to be pung.
public string Path
{
get { return Location.ToString(); }
}
protected bool IsFileUri
{
get { return Location.IsFile || Location.IsUnc; }
}
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The location.
public UriPinger(Uri location)
{
if (location == null)
throw new ArgumentNullException("location");
_Location = location;
}
#endregion
#region Overrides
///
/// Returns a that represents the current .
///
///
/// A that represents the current .
///
public override string ToString()
{
return Path;
}
#endregion
#region Ping
///
/// Pings the specified .
///
///
/// The of the ping request.
///
public abstract PingResponse Ping();
///
/// Starts an asynchronous ping of the specified .
///
/// The callback function to be called when the ping has completed.
public abstract void Ping(PingerCallback callback);
#endregion
}
}