I'm trying to detect if our application is running from a DVD (because this disables/enables functionality in the logic). So far I've come up with the code snippet below that seems to work, though I was really wondering if there's a best-practice in detecting this.
public static bool IsDVDInstallation()
{
try
{
string location = Assembly.GetExecutingAssembly().Location;
var info = new DriveInfo(Path.GetPathRoot(location));
return info.DriveType == DriveType.CDRom;
}
catch
{
return false;
}
}