Example #1
0
        public override AssemblyIdentity ResolvePartialName(
            string displayName,
            out string location,
            ImmutableArray <ProcessorArchitecture> architectureFilter,
            CultureInfo preferredCulture)
        {
            if (displayName == null)
            {
                throw new ArgumentNullException(nameof(displayName));
            }

            location = null;
            FusionAssemblyIdentity.IAssemblyName nameObject = FusionAssemblyIdentity.ToAssemblyNameObject(displayName);
            if (nameObject == null)
            {
                return(null);
            }

            var    candidates  = GetAssemblyObjects(nameObject, architectureFilter);
            string cultureName = (preferredCulture != null && !preferredCulture.IsNeutralCulture) ? preferredCulture.Name : null;

            var bestMatch = FusionAssemblyIdentity.GetBestMatch(candidates, cultureName);

            if (bestMatch == null)
            {
                return(null);
            }

            location = GetAssemblyLocation(bestMatch);
            return(FusionAssemblyIdentity.ToAssemblyIdentity(bestMatch));
        }
Example #2
0
 private static IEnumerable <AssemblyIdentity> GetAssemblyIdentities(
     FusionAssemblyIdentity.IAssemblyName partialName,
     ImmutableArray <ProcessorArchitecture> architectureFilter)
 {
     return(from nameObject in GetAssemblyObjects(partialName, architectureFilter)
            select FusionAssemblyIdentity.ToAssemblyIdentity(nameObject));
 }
Example #3
0
        private static AssemblyIdentity ResolvePartialName(
            string displayName,
            Func <ProcessorArchitecture, bool> architectureFilter,
            CultureInfo preferredCulture,
            out string location,
            bool resolveLocation)
        {
            if (displayName == null)
            {
                throw new ArgumentNullException("displayName");
            }

            location = null;
            FusionAssemblyIdentity.IAssemblyName nameObject = FusionAssemblyIdentity.ToAssemblyNameObject(displayName);
            if (nameObject == null)
            {
                return(null);
            }

            var    candidates  = GetAssemblyObjects(nameObject, architectureFilter);
            string cultureName = (preferredCulture != null && !preferredCulture.IsNeutralCulture) ? preferredCulture.Name : null;

            var bestMatch = FusionAssemblyIdentity.GetBestMatch(candidates, cultureName);

            if (bestMatch == null)
            {
                return(null);
            }

            if (resolveLocation)
            {
                location = GetAssemblyLocation(bestMatch);
            }

            return(FusionAssemblyIdentity.ToAssemblyIdentity(bestMatch));
        }