static bool IsSingleInstance()
{
try
{
// Try to open existing mutex.
Mutex.OpenExisting(minepath.Replace(Path.DirectorySeparatorChar, '_'));
}
catch
{
// If exception occurred, there is no such mutex.
_m = new Mutex(true, minepath.Replace(Path.DirectorySeparatorChar, '_'));
// Only one instance.
return true;
}
// More than one instance.
return false;
}