Example #1
0
        /// <summary>
        /// Creates a new external implementation.
        /// </summary>
        /// <param name="distribution">The name of the distribution (e.g. Debian, RPM) where this implementation comes from.</param>
        /// <param name="package">The name of the package in the <paramref name="distribution"/>.</param>
        /// <param name="version">The version number of the implementation.</param>
        /// <param name="cpu">For platform-specific binaries, the CPU architecture for which the implementation was compiled.</param>
        public ExternalImplementation(string distribution, string package, ImplementationVersion version, Cpu cpu = Cpu.All)
        {
            #region Sanity checks
            if (string.IsNullOrEmpty(distribution))
            {
                throw new ArgumentNullException(nameof(distribution));
            }
            if (string.IsNullOrEmpty(package))
            {
                throw new ArgumentNullException(nameof(package));
            }
            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }
            #endregion

            ID = PackagePrefix + distribution.ToLowerInvariant() + ":" + package + ":" + version;

            Version      = version;
            Stability    = Stability.Packaged;
            Distribution = distribution;
            Package      = package;

            if (cpu != Cpu.All)
            {
                ID          += ":" + cpu.ConvertToString();
                Architecture = new Architecture(OS.All, cpu);
            }
        }