internal bool RemoveLockFile()
{
bool success = false;
try
{
if (Directory.Exists(_rootDataDirectory))
{
var lockFilePath = Path.Combine(_rootDataDirectory, LockFile);
if (File.Exists(lockFilePath))
{
File.Delete(lockFilePath);
success = true;
}
}
}
catch (Exception e)
{
Logging.Error("An error occured removing the profile lock file.", e);
}
return success;
}
private static void LogMessageAndExit(Exception ex) { // Since we can't prevent the app from terminating, log this to the event log. Logging.Fatal(ErrorMsg, ex); if (_app != null) { _app.RemoveLockFile(); } Environment.Exit(1); }