/// <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;
            }

        }
Ejemplo n.º 2
0
        /// <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;
            }

        }
Ejemplo n.º 3
0
 public Installer(InstallationRequest request)
 {
     Init(request);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Parse an argument string array into an installation request and wait on a calling process if there was one
        /// </summary>
        /// <param name="argString"></param>
        /// <returns></returns>
        public static InstallationRequest ParseArgsAndWait(string[] argString)
        {
            var request = new InstallationRequest();

            var args = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
            foreach (var pair in argString)
            {
                var nameValue = pair.Split('=');
                if (nameValue.Length == 2)
                {
                    args[nameValue[0]] = nameValue[1];
                }
            }
            request.Archive = args.GetValueOrDefault("archive", null);

            request.Product = args.GetValueOrDefault("product", null) ?? ConfigurationManager.AppSettings["product"] ?? "server";
            request.PackageClass = (PackageVersionClass)Enum.Parse(typeof(PackageVersionClass), args.GetValueOrDefault("class", null) ?? ConfigurationManager.AppSettings["class"] ?? "Release");
            request.Version = new Version(args.GetValueOrDefault("version", "4.0"));
            request.ServiceName = args.GetValueOrDefault("service", string.Empty);
            request.ProgramDataPath = args.GetValueOrDefault("installpath", null);
            request.TargetExecutablePath = args.GetValueOrDefault("startpath", null);
            request.SystemPath = args.GetValueOrDefault("systempath", null);

            var callerId = args.GetValueOrDefault("caller", null);
            if (callerId != null)
            {
                // Wait for our caller to exit
                try
                {
                    var process = Process.GetProcessById(Convert.ToInt32(callerId));
                    process.WaitForExit();
                }
                catch (ArgumentException)
                {
                    // wasn't running
                }

                request.Operation = InstallOperation.Update;
            }
            else
            {
                request.Operation = InstallOperation.Install;
            }

            return request;
        }