namespace ChadSoft.Utils.Pingy.Pingers
{
using System;
using System.IO;
using ChadSoft.Logging;
public class FilePinger : UriPinger
{
public FilePinger(Uri location) : base(location)
{
}
///
/// Pings the specified .
///
///
/// The of the ping request.
///
public override PingResponse Ping()
{
PingResponse resp;
try
{
if (File.Exists(Location.AbsolutePath))
resp = new PingResponse(PingStatus.Exists);
else
resp = new PingResponse(PingStatus.NotFound);
}
catch (Exception ex)
{
Logger.Error(ex);
resp = new PingResponse(PingStatus.Error, ex.Message);
}
return resp;
}
///
/// Starts an asynchronous ping of the specified .
///
/// The callback function to be called when the ping has completed.
public override void Ping(PingerCallback callback)
{
throw new NotImplementedException();
}
}
}