void GetMediaPortalPath(ref editorPaths mpPaths)
{
string sRegRoot = "SOFTWARE";
if (IntPtr.Size > 4)
sRegRoot += "\\Wow6432Node";
try
{
RegistryKey MediaPortalKey = Registry.LocalMachine.OpenSubKey(sRegRoot + "\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MediaPortal\\", false);
if (MediaPortalKey != null)
{
mpPaths.sMPbaseDir = MediaPortalKey.GetValue("InstallPath").ToString();
}
else
{
MediaPortalKey = MediaPortalKey.OpenSubKey(sRegRoot + "\\Team MediaPortal\\MediaPortal\\", false);
if (MediaPortalKey != null)
{
mpPaths.sMPbaseDir = MediaPortalKey.GetValue("ApplicationDir").ToString();
}
else
mpPaths.sMPbaseDir = null;
}
}
catch (Exception e)
{
MessageBox.Show("Exception while attempting to read MediaPortal location from registry\n\nMediaPortal must be installed, is MediaPortal Installed?\n\n" + e.Message.ToString());
mpPaths.sMPbaseDir = null;
}
}