Exemplo n.º 1
0
        protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey)
        {
            string installerType = reader.GetAttribute("type");

            if (string.IsNullOrEmpty(installerType))
            {
                installerType = InstallerType.msi.ToString();
            }
            InstallerType type = (InstallerType)Enum.Parse(typeof(InstallerType), installerType);

            switch (type)
            {
            case InstallerType.noop:
                _config = new NoopInstallerConfig(_destinationPath, _copyMethod);
                break;

            case InstallerType.dni:
                _config = new DniInstallerConfig(_destinationPath, _copyMethod);
                break;

            case InstallerType.exe:
                _config = new ExeInstallerConfig(_destinationPath, _copyMethod);
                break;

            case InstallerType.msi:
            default:
                _config = new MsiInstallerConfig(_destinationPath, _copyMethod);
                break;
            }

            _config.ProxyDeserializeElement(reader, serializeCollectionKey);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reduces the installer type to its most generic type.
        /// </summary>
        /// <returns>
        /// <see cref="InstallerType.Msix"/> for Windows App Packages,
        /// <see cref="InstallerType.Win32"/> for traditional Win32 installers,
        /// <see cref="InstallerType.Unknown"/> for everything else.
        /// </returns>
        public static InstallerType Reduce(this InstallerType type)
        {
            uint genericId = (uint)type >> 28;

            return(genericId switch
            {
                ((uint)InstallerType.Msix >> 28) => InstallerType.Msix,
                ((uint)InstallerType.Win32 >> 28) => InstallerType.Win32,

                0 or _ => InstallerType.Unknown
            });
Exemplo n.º 3
0
        /// <summary>
        /// Converts the value of this instance to its equivalent <see cref="Guid"/> representation.
        /// </summary>
        /// <param name="installerType"></param>
        /// <returns></returns>
        public static Guid AsGuid(this InstallerType installerType)
        {
            switch (installerType)
            {
            case InstallerType.Installer:
                return(new Guid(InstallerGuid));

            case InstallerType.File:
                return(new Guid(FileGuid));

            case InstallerType.OpaqueString:
                return(new Guid(OpaqueStringGuid));

            case InstallerType.WindowsInstaller:
                return(new Guid(MsiGuid));

            case InstallerType.OsInstallGuid:
                return(new Guid(OsInstallGuid));

            default:
                throw new NotSupportedException("InstallerType " + installerType +
                                                " is not implemented by the ToGuid() method.");
            }
        }
 /// <summary>
 /// Initializes a new instance of <see cref="InstallerDescription"/> using the data specified in the given <see cref="FusionInstallReference"/>.
 /// </summary>
 /// <param name="fusionInstallReference"></param>
 internal InstallerDescription(FusionInstallReference fusionInstallReference)
 {
   _installerType = fusionInstallReference.GuidScheme.AsInstallerType();
   _applicationDescription = fusionInstallReference.NonCannonicalData;
   _uniqueId = fusionInstallReference.Identifier;
 }
 /// <summary>
 /// Initializes a new instance of <see cref="InstallerDescription"/> from the values specified.
 /// </summary>
 /// <param name="installerType"></param>
 /// <param name="applicationDescription"></param>
 /// <param name="uniqueId"></param>
 private InstallerDescription(InstallerType installerType, string uniqueId, string applicationDescription)
 {
   _installerType = installerType;
   _uniqueId = uniqueId;
   _applicationDescription = applicationDescription;
 }
Exemplo n.º 6
0
        public static VersionEnclosure SelectEnclosure(VersionEnclosure[] enclosures, InstallerType type, InstallerPlatform platform)
        {
            var enclosure = enclosures.FirstOrDefault(e => e.InstallerType == type && e.InstallerPlatform == platform);

            if (enclosure != null)
            {
                return(enclosure);
            }
            switch (platform)
            {
            case InstallerPlatform.WindowsArm:
            case InstallerPlatform.WindowsArm64:
                return(SelectEnclosure(enclosures, type, InstallerPlatform.WindowsX86));

            case InstallerPlatform.Any:
                return(SelectEnclosure(enclosures, type, InstallerPlatform.Unknown));

            case InstallerPlatform.Unknown:
                return(enclosures.First(e => e.InstallerType == type && e.InstallerPlatform == InstallerPlatform.Any));

            default:
                return(SelectEnclosure(enclosures, type, InstallerPlatform.Any));
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of <see cref="InstallerDescription"/> using the data specified in the given <see cref="FusionInstallReference"/>.
 /// </summary>
 /// <param name="fusionInstallReference"></param>
 internal InstallerDescription(FusionInstallReference fusionInstallReference)
 {
     _installerType          = fusionInstallReference.GuidScheme.AsInstallerType();
     _applicationDescription = fusionInstallReference.NonCannonicalData;
     _uniqueId = fusionInstallReference.Identifier;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of <see cref="InstallerDescription"/> from the values specified.
 /// </summary>
 /// <param name="installerType"></param>
 /// <param name="applicationDescription"></param>
 /// <param name="uniqueId"></param>
 private InstallerDescription(InstallerType installerType, string uniqueId, string applicationDescription)
 {
     _installerType          = installerType;
     _uniqueId               = uniqueId;
     _applicationDescription = applicationDescription;
 }
        /// <summary>
        /// Get the url where to download the .net installer
        /// </summary>
        /// <param name="version"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string GetVersionUrl(string version, InstallerType type)
        {
            if (type == InstallerType.Full)
            {
                switch (version)
                {
                case "4.7.2":
                    return("http://go.microsoft.com/fwlink/?LinkId=863265");

                case "4.7.1":
                    return("http://go.microsoft.com/fwlink/?LinkId=852104");

                case "4.7":
                    return("http://go.microsoft.com/fwlink/?LinkId=825302");

                case "4.6.2":
                    return("http://go.microsoft.com/fwlink/?LinkId=780600");

                case "4.6.1":
                    return("http://go.microsoft.com/fwlink/?LinkId=671743");

                case "4.6":
                    return("http://go.microsoft.com/fwlink/?LinkId=528232");

                case "4.5.2":
                    return("http://go.microsoft.com/fwlink/?LinkId=397708");

                case "4.5.1":
                    return("http://go.microsoft.com/fwlink/?LinkId=322116");

                case "4.5":
                    return("http://go.microsoft.com/fwlink/?LinkId=225702");
                }
            }
            else
            {
                switch (version)
                {
                case "4.7.2":
                    return("http://go.microsoft.com/fwlink/?LinkId=863262");

                case "4.7.1":
                    return("http://go.microsoft.com/fwlink/?LinkId=852092");

                case "4.7":
                    return("http://go.microsoft.com/fwlink/?LinkId=825298");

                case "4.6.2":
                    return("http://go.microsoft.com/fwlink/?LinkId=780596");

                case "4.6.1":
                    return("http://go.microsoft.com/fwlink/?LinkId=671728");

                case "4.6":
                    return("http://go.microsoft.com/fwlink/?LinkId=528222");

                case "4.5.2":
                    return("http://go.microsoft.com/fwlink/?LinkId=397707");

                case "4.5.1":
                    return("http://go.microsoft.com/fwlink/?LinkId=322115");

                case "4.5":
                    return("http://go.microsoft.com/fwlink/?LinkId=225704");
                }
            }

            return(null);
        }