Beginnings of support for MBClassic in our installer

pull/702/head
Eric Reed 12 years ago
parent b789550a56
commit e6b03ea450

@ -26,10 +26,12 @@ namespace MediaBrowser.Installer
protected string PackageName = "MBServer"; protected string PackageName = "MBServer";
protected string RootSuffix = "-Server"; protected string RootSuffix = "-Server";
protected string TargetExe = "MediaBrowser.ServerApplication.exe"; protected string TargetExe = "MediaBrowser.ServerApplication.exe";
protected string TargetArgs = "";
protected string FriendlyName = "Media Browser Server"; protected string FriendlyName = "Media Browser Server";
protected string Archive = null; protected string Archive = null;
protected bool InstallPismo = true; protected bool InstallPismo = true;
protected string RootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser-Server"); protected string RootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser-Server");
protected string EndInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser-Server");
protected bool IsUpdate = false; protected bool IsUpdate = false;
@ -133,6 +135,18 @@ namespace MediaBrowser.Installer
RootSuffix = "-Theater"; RootSuffix = "-Theater";
TargetExe = "MediaBrowser.UI.exe"; TargetExe = "MediaBrowser.UI.exe";
FriendlyName = "Media Browser Theater"; FriendlyName = "Media Browser Theater";
RootPath = EndInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
EndInstallPath = Path.Combine(RootPath, "system");
break;
case "mbc":
PackageName = "MBClassic";
RootSuffix = "-WMC";
TargetExe = "ehshell.exe";
TargetArgs = @"/nostartupanimation /entrypoint:{CE32C570-4BEC-4aeb-AD1D-CF47B91DE0B2}\{FC9ABCCC-36CB-47ac-8BAB-03E8EF5F6F22}";
FriendlyName = "Media Browser Classic";
RootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
EndInstallPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "ehome");
break; break;
default: default:
@ -140,10 +154,11 @@ namespace MediaBrowser.Installer
RootSuffix = "-Server"; RootSuffix = "-Server";
TargetExe = "MediaBrowser.ServerApplication.exe"; TargetExe = "MediaBrowser.ServerApplication.exe";
FriendlyName = "Media Browser Server"; FriendlyName = "Media Browser Server";
RootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
EndInstallPath = Path.Combine(RootPath, "system");
break; break;
} }
RootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
} }
@ -274,8 +289,7 @@ namespace MediaBrowser.Installer
} }
catch (Exception e) catch (Exception e)
{ {
SystemClose("Error Installing Pismo - "+e.GetType().FullName+"\n\n"+e.Message); SystemClose("Error Installing ISO support - "+e.GetType().FullName+"\n\n"+e.Message);
return;
} }
} }
@ -286,11 +300,11 @@ namespace MediaBrowser.Installer
lblStatus.Text = string.Format("Starting {0}...", FriendlyName); lblStatus.Text = string.Format("Starting {0}...", FriendlyName);
try try
{ {
Process.Start(fullPath); Process.Start(Path.Combine(EndInstallPath, TargetExe), TargetArgs);
} }
catch (Exception e) catch (Exception e)
{ {
SystemClose("Error Executing - "+fullPath+ " "+e.GetType().FullName+"\n\n"+e.Message); SystemClose("Error Executing - "+Path.Combine(EndInstallPath, TargetExe) + " " + TargetArgs + "\n\n" +e.GetType().FullName+"\n\n"+e.Message);
return; return;
} }
@ -432,8 +446,7 @@ namespace MediaBrowser.Installer
else else
{ {
//Rollback //Rollback
if (Directory.Exists(systemDir)) Directory.Delete(systemDir); RollBack(systemDir, backupDir);
Directory.Move(backupDir, systemDir);
File.Delete(archive); // so we don't try again if its an update File.Delete(archive); // so we don't try again if its an update
throw; throw;
} }
@ -441,6 +454,15 @@ namespace MediaBrowser.Installer
} }
} }
protected void RollBack(string systemDir, string backupDir)
{
if (Directory.Exists(backupDir))
{
if (Directory.Exists(systemDir)) Directory.Delete(systemDir);
Directory.Move(backupDir, systemDir);
}
}
/// <summary> /// <summary>
/// Create a shortcut in the current user's start menu /// Create a shortcut in the current user's start menu
/// Only do current user to avoid need for admin elevation /// Only do current user to avoid need for admin elevation

Loading…
Cancel
Save