Skip to content

Instantly share code, notes, and snippets.

@jaysonrowe
Created September 20, 2012 01:56
Show Gist options
  • Save jaysonrowe/3753536 to your computer and use it in GitHub Desktop.
Save jaysonrowe/3753536 to your computer and use it in GitHub Desktop.
TopShelf Start Method
public void Start()
{
try
{
watcher.Path = watcherpath;
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
watcher.Filter = "*.bak";
watcher.Filter = "*.tmp";
watcher.Renamed += new RenamedEventHandler(restoredb);
watcher.EnableRaisingEvents = true;
}
catch (FailedOperationException)
{
Console.WriteLine("INFO: Aborted");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment