private void ActivationsControl_Load(object sender, EventArgs e) { InstallOperation operation = this.Form.Operation; ActivationReporter.ReportActivationsToList(operation, ActivationsList); ActivationCount.Text = ActivationsList.Items.Count.ToString() + " Instances"; }
public static void ReportActivationsToList(InstallOperation operation, ListView list) { ActivationReporter reporter = new ActivationReporter(operation, list); reporter.ReportActivations(); return; }
private FeaturesCommand(InstallProcessControl parent, FeatureActivator.ActivationDirection direction, InstallOperation operation) : base(parent) { this.direction = direction; this.operation = operation; requestedLocs = InstallProcessControl.GetFeaturedLocations(operation); }
private FeatureActivator(ActivationDirection direction, InstallOperation operation, ILog log) { this.direction = direction; this.operation = operation; this.log = log; requestedLocs = InstallProcessControl.GetFeaturedLocations(operation); }
/// <summary> /// 完成安装 /// </summary> public void OnCompleteInstall() { string exePath = Path.Combine(m_curInstallExePath, InstallerConfig.Config.ExeFile); if (File.Exists(exePath)) { InstallOperation.CreateShortcuts(exePath); this.materialTextButton5.Visible = true; } else { MessageBox.Show(string.Format("未能为{0}创建快捷方式", InstallerConfig.Config.ExeFile)); } }
/// <summary> /// Initialize our internal variables from an installation request /// </summary> /// <param name="request"></param> protected void Init(InstallationRequest request) { Operation = request.Operation; Archive = request.Archive; PackageClass = request.PackageClass; RequestedVersion = request.Version ?? new Version("4.0"); Progress = request.Progress; ReportStatus = request.ReportStatus; MainClient = request.WebClient; ServiceName = request.ServiceName; AppDataFolder = request.InstallPath ?? Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); switch (request.Product.ToLower()) { case "mbt": PackageName = "MBTheater"; RootSuffix = "-Theater"; TargetExe = "MediaBrowser.UI.exe"; FriendlyName = "Media Browser Theater"; RootPath = request.InstallPath ?? Path.Combine(AppDataFolder, "MediaBrowser" + RootSuffix); EndInstallPath = Path.Combine(RootPath, "system"); break; case "mbc": PackageName = "MBClassic"; RootSuffix = "-Classic"; 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; default: PackageName = "MBServer"; RootSuffix = "-Server"; TargetExe = "MediaBrowser.ServerApplication.exe"; FriendlyName = "Media Browser Server"; RootPath = request.InstallPath ?? Path.Combine(AppDataFolder, "MediaBrowser" + RootSuffix); EndInstallPath = Path.Combine(RootPath, "system"); break; } }
/// <summary> /// Initialize our internal variables from an installation request /// </summary> /// <param name="request"></param> protected void Init(InstallationRequest request) { Operation = request.Operation; Archive = request.Archive; PackageClass = request.PackageClass; RequestedVersion = request.Version ?? new Version("4.0"); Progress = request.Progress; ReportStatus = request.ReportStatus; MainClient = request.WebClient; ServiceName = request.ServiceName; switch (request.Product.ToLower()) { case "mbt": PackageName = "MBTheater"; FriendlyName = "Emby Theater"; ProgramDataPath = request.ProgramDataPath ?? GetTheaterProgramDataPath(); TargetExecutablePath = request.TargetExecutablePath ?? Path.Combine(ProgramDataPath, "system", "MediaBrowser.UI.exe"); SystemPath = request.SystemPath ?? Path.GetDirectoryName(TargetExecutablePath); break; case "mbc": PackageName = "MBClassic"; TargetArgs = @"/nostartupanimation /entrypoint:{CE32C570-4BEC-4aeb-AD1D-CF47B91DE0B2}\{FC9ABCCC-36CB-47ac-8BAB-03E8EF5F6F22}"; FriendlyName = "Emby for WMC"; ProgramDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + "-Classic"); TargetExecutablePath = request.TargetExecutablePath ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "ehome", "ehshell.exe"); SystemPath = request.SystemPath ?? Path.Combine(ProgramDataPath, "system"); break; default: PackageName = "MBServer"; FriendlyName = "Emby Server"; ProgramDataPath = request.ProgramDataPath ?? GetServerProgramDataPath(); TargetExecutablePath = request.TargetExecutablePath ?? Path.Combine(ProgramDataPath, "system", "MediaBrowser.ServerApplication.exe"); SystemPath = request.SystemPath ?? Path.GetDirectoryName(TargetExecutablePath); break; } }
/// <summary> /// Initialize our internal variables from an installation request /// </summary> /// <param name="request"></param> protected void Init(InstallationRequest request) { Operation = request.Operation; Archive = request.Archive; PackageClass = request.PackageClass; RequestedVersion = request.Version ?? new Version("4.0"); Progress = request.Progress; ReportStatus = request.ReportStatus; MainClient = request.WebClient; ServiceName = request.ServiceName; switch (request.Product.ToLower()) { case "emby.theater": PackageName = "emby.theater"; FriendlyName = "Emby Theater"; ProgramDataPath = request.ProgramDataPath ?? GetTheaterProgramDataPath(); TargetExecutablePath = request.TargetExecutablePath ?? Path.Combine(ProgramDataPath, "system", "Emby.Theater.exe"); SystemPath = request.SystemPath ?? Path.GetDirectoryName(TargetExecutablePath); ExtractRelativeToSystemDirectory = true; break; case "mbc": PackageName = "MBClassic"; TargetArgs = @"/nostartupanimation /entrypoint:{CE32C570-4BEC-4aeb-AD1D-CF47B91DE0B2}\{FC9ABCCC-36CB-47ac-8BAB-03E8EF5F6F22}"; FriendlyName = "Emby for WMC"; ProgramDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + "-Classic"); TargetExecutablePath = request.TargetExecutablePath ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "ehome", "ehshell.exe"); SystemPath = request.SystemPath ?? Path.Combine(ProgramDataPath, "system"); break; default: PackageName = "MBServer"; FriendlyName = "Emby Server"; ProgramDataPath = request.ProgramDataPath ?? GetServerProgramDataPath(); TargetExecutablePath = request.TargetExecutablePath ?? Path.Combine(ProgramDataPath, "system", "MediaBrowser.ServerApplication.exe"); SystemPath = request.SystemPath ?? Path.GetDirectoryName(TargetExecutablePath); break; } }
public static void PerformActivations(ActivationDirection direction, InstallOperation operation, ILog log) { FeatureActivator factor = new FeatureActivator(direction, operation, log); try { factor.PerformAllActivations(); return; } catch (Exception exc) { log.Error("Error: " + direction.ToString(), exc); } if (factor.rollback) { return; } if (factor.completedLocs.LocationsCount == 0) { log.Info("No feature de/activations completed, so none to rollback"); return; } // Switch actions & execute rollback factor.rollback = true; factor.direction = (factor.direction == ActivationDirection.Activate ? ActivationDirection.Deactivate : ActivationDirection.Activate); factor.requestedLocs = factor.completedLocs; try { log.Info("Rollback: " + FeatureActivator.Describe(factor.requestedLocs, factor.direction)); factor.PerformAllActivations(); } catch (Exception exc) { log.Error("Error during rollback: " + direction.ToString(), exc); } }
private ActivationReporter(InstallOperation operation, ListView list) { myOperation = operation; myList = list; }
public static Command CreateActivatorCommand(InstallProcessControl parent, InstallOperation operation) { FeaturesCommand cmd = new FeaturesCommand(parent, FeatureActivator.ActivationDirection.Activate, operation); return(cmd); }
public static void PerformActivations(ActivationDirection direction, InstallOperation operation, ILog log) { FeatureActivator factor = new FeatureActivator(direction, operation, log); try { factor.PerformAllActivations(); return; } catch (Exception exc) { log.Error("Error: " + direction.ToString(), exc); } if (factor.rollback) return; if (factor.completedLocs.LocationsCount == 0) { log.Info("No feature de/activations completed, so none to rollback"); return; } // Switch actions & execute rollback factor.rollback = true; factor.direction = (factor.direction == ActivationDirection.Activate ? ActivationDirection.Deactivate : ActivationDirection.Activate); factor.requestedLocs = factor.completedLocs; try { log.Info("Rollback: " + FeatureActivator.Describe(factor.requestedLocs, factor.direction)); factor.PerformAllActivations(); } catch (Exception exc) { log.Error("Error during rollback: " + direction.ToString(), exc); } }
public static Command CreateDeactivatorCommand(InstallProcessControl parent, InstallOperation operation) { FeaturesCommand cmd = new FeaturesCommand(parent, FeatureActivator.ActivationDirection.Deactivate, operation); return cmd; }