示例#1
0
 public void TestResolvePackageInstallPreference(
     string pattern,
     InstallationSource preference,
     string packageName,
     bool packageIsDev,
     InstallationSource expected)
 {
     manager.SetPreferences(new[] { (pattern, preference) });
示例#2
0
        /// <summary>
        /// Get the specified Uri address, including the mirror uri.
        /// </summary>
        /// <param name="uri">The base uri.</param>
        /// <param name="mirrors">An array of mirrors.</param>
        /// <param name="reference">The source reference.</param>
        /// <param name="type">The type of repository type or distribution archive.</param>
        /// <param name="installationSource">Source from which this package was installed.</param>
        protected string[] GetUrisWithMirrors(string uri, string[] mirrors, string reference, string type, InstallationSource installationSource)
        {
            if (string.IsNullOrEmpty(uri))
            {
                return(Array.Empty <string>());
            }

            mirrors = mirrors ?? Array.Empty <string>();

            var uris = new LinkedList <string>();

            uris.AddLast(uri);

            foreach (var mirror in mirrors)
            {
                if (installationSource == InstallationSource.Dist)
                {
                    uris.AddLast(BucketMirror.ProcessUri(mirror, GetName(), GetVersion(), reference, type));
                }
                else
                {
                    uris.AddLast(BucketMirror.ProcessUriGit(mirror, GetName(), uri, type));
                }
            }

            return(uris.ToArray());
        }