コード例 #1
0
        private static NetPortableProfileCollection BuildPortableProfileCollection()
        {
            var profileCollection = new NetPortableProfileCollection();

            var referenceAssembliesPath = FrameworkReferenceResolver.GetReferenceAssembliesPath();

            if (!string.IsNullOrEmpty(referenceAssembliesPath))
            {
                string portableRootDirectory = Path.Combine(referenceAssembliesPath, ".NETPortable");

                if (Directory.Exists(portableRootDirectory))
                {
                    foreach (string versionDir in Directory.EnumerateDirectories(portableRootDirectory, "v*", SearchOption.TopDirectoryOnly))
                    {
                        string profileFilesPath = Path.Combine(versionDir, "Profile");
                        foreach (var profile in LoadProfilesFromFramework(versionDir, profileFilesPath))
                        {
                            profileCollection.Add(profile);
                        }
                    }
                }
            }

            return(profileCollection);
        }
コード例 #2
0
        private static NetPortableProfileCollection BuildPortableProfileCollection()
        {
            var profileCollection = new NetPortableProfileCollection();

            string portableRootDirectory;

            string portableReferencePathOverride = Environment.GetEnvironmentVariable(PortableReferenceAssemblyPathEnvironmentVariableName);

            if (!string.IsNullOrEmpty(portableReferencePathOverride))
            {
                portableRootDirectory = portableReferencePathOverride;
            }
            else
            {
                portableRootDirectory =
                    Path.Combine(
                        Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86, Environment.SpecialFolderOption.DoNotVerify),
                        @"Reference Assemblies\Microsoft\Framework\.NETPortable");
            }

            if (Directory.Exists(portableRootDirectory))
            {
                foreach (string versionDir in Directory.EnumerateDirectories(portableRootDirectory, "v*", SearchOption.TopDirectoryOnly))
                {
                    string profileFilesPath = versionDir + @"\Profile\";
                    profileCollection.AddRange(LoadProfilesFromFramework(versionDir, profileFilesPath));
                }
            }

            return(profileCollection);
        }
コード例 #3
0
        private static NetPortableProfileCollection BuildPortableProfileCollection()
        {
            var profileCollection = new NetPortableProfileCollection();

            string portableRootDirectory;

            string portableReferencePathOverride = Environment.GetEnvironmentVariable(PortableReferenceAssemblyPathEnvironmentVariableName);

            if (!string.IsNullOrEmpty(portableReferencePathOverride))
            {
                portableRootDirectory = portableReferencePathOverride;
            }
            else
            {
                portableRootDirectory = GetPortableRootDirectory();
            }

            if (Directory.Exists(portableRootDirectory))
            {
                foreach (string versionDir in Directory.EnumerateDirectories(portableRootDirectory, "v*", SearchOption.TopDirectoryOnly))
                {
                    string profileFilesPath = Path.Combine(versionDir, "Profile");
                    profileCollection.AddRange(LoadProfilesFromFramework(versionDir, profileFilesPath));
                }
            }

            return(profileCollection);
        }
コード例 #4
0
        public NetPortableProfileTable(IEnumerable <NetPortableProfile> profiles)
        {
            Profiles = new NetPortableProfileCollection();
            Profiles.AddRange(profiles);

            // Index profiles
            _portableProfilesByCustomProfileString = Profiles.ToDictionary(p => p.CustomProfileString);
            CreateOptionalFrameworksDictionary();
        }
        public ReferenceAssemblyPortableFrameworkMappings(NetPortableProfileCollection profileCollection)
        {
            var table = new NetPortableProfileTable(profileCollection);

            foreach (var profile in profileCollection)
            {
                AddPortableProfile(table, profile);
            }
        }
コード例 #6
0
        private static NetPortableProfileCollection BuildPortableProfileCollection()
        {
            var profileCollection = new NetPortableProfileCollection();

            profileCollection.AddRange(LoadProfilesFromFramework("v4.0"));
            profileCollection.AddRange(LoadProfilesFromFramework("v4.5"));

            return(profileCollection);
        }
コード例 #7
0
 /// <summary>
 /// The setter should only ever be used by tests.
 /// </summary>
 internal static void SetProfileCollection(NetPortableProfileCollection profileCollection)
 {
     if (profileCollection == null)
     {
         _instance = null;
     }
     else
     {
         _instance = new NetPortableProfileTable(profileCollection);
     }
 }
コード例 #8
0
            public CompiledNetPortableProfileCollection(NetPortableProfileCollection profileCollection)
            {
                if (profileCollection == null)
                {
                    throw new ArgumentNullException("profileCollection");
                }

                Profiles = profileCollection;
                PortableProfilesByCustomProfileString   = CreatePortableProfilesByCustomProfileString(profileCollection);
                PortableProfilesSetByOptionalFrameworks = CreateOptionalFrameworksDictionary(profileCollection);
            }
コード例 #9
0
        private static NetPortableProfileCollection BuildPortableProfileCollection()
        {
            var profileCollection = new NetPortableProfileCollection();

#if DESKTOP // CORECLR_TODO: Environment.GetFolderPath
            string portableRootDirectory =
                Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86, Environment.SpecialFolderOption.DoNotVerify),
                    @"Reference Assemblies\Microsoft\Framework\.NETPortable");

            if (Directory.Exists(portableRootDirectory))
            {
                foreach (string versionDir in Directory.EnumerateDirectories(portableRootDirectory, "v*", SearchOption.TopDirectoryOnly))
                {
                    string profileFilesPath = versionDir + @"\Profile\";
                    profileCollection.AddRange(LoadProfilesFromFramework(versionDir, profileFilesPath));
                }
            }
#endif

            return(profileCollection);
        }
コード例 #10
0
            private static IDictionary <string, List <VersionStringISetTuple> > CreateOptionalFrameworksDictionary(NetPortableProfileCollection profileCollection)
            {
                var portableProfilesSetByOptionalFrameworks = new Dictionary <string, List <VersionStringISetTuple> >();

                foreach (var portableProfile in profileCollection)
                {
                    foreach (var optionalFramework in portableProfile.OptionalFrameworks)
                    {
                        if (optionalFramework != null && optionalFramework.Identifier != null)
                        {
                            // Add portableProfile.Name to the list of profileName corresponding to optionalFramework.Identifier
                            if (!portableProfilesSetByOptionalFrameworks.ContainsKey(optionalFramework.Identifier))
                            {
                                portableProfilesSetByOptionalFrameworks.Add(optionalFramework.Identifier, new List <VersionStringISetTuple>());
                            }
                        }

                        List <VersionStringISetTuple> listVersionStringISetTuple = portableProfilesSetByOptionalFrameworks[optionalFramework.Identifier];
                        if (listVersionStringISetTuple != null)
                        {
                            VersionStringISetTuple versionStringITuple = listVersionStringISetTuple.Where(tuple => tuple.Item1.Equals(optionalFramework.Version)).FirstOrDefault();
                            if (versionStringITuple == null)
                            {
                                versionStringITuple = new VersionStringISetTuple(optionalFramework.Version, new HashSet <string>());
                                listVersionStringISetTuple.Add(versionStringITuple);
                            }
                            versionStringITuple.Item2.Add(portableProfile.Name);
                        }
                    }
                }

                return(portableProfilesSetByOptionalFrameworks);
            }
コード例 #11
0
 private static IDictionary <string, NetPortableProfile> CreatePortableProfilesByCustomProfileString(NetPortableProfileCollection profileCollection)
 {
     // If multiple profiles end up having the same CustomProfileString (that is, the
     // same set of contained TFMs), prefer the last one found.
     return(profileCollection
            .ToLookup(x => x.CustomProfileString)
            .ToDictionary(g => g.Key, g => g.Last()));
 }
コード例 #12
0
 public NetPortableProfileTable(NetPortableProfileCollection profileCollection)
 {
     _compiled = new CompiledNetPortableProfileCollection(profileCollection);
 }
 public ReferenceAssemblyFrameworkNameProvider(NetPortableProfileCollection profileCollection)
     : base(GetMappings(), GetPortableMappings(profileCollection))
 {
 }
 private static IEnumerable <IPortableFrameworkMappings> GetPortableMappings(NetPortableProfileCollection profileCollection)
 {
     yield return(new ReferenceAssemblyPortableFrameworkMappings(profileCollection));
 }
コード例 #15
0
 public ReferenceAssemblyCompatibilityProvider(NetPortableProfileCollection profileCollection)
     : base(new ReferenceAssemblyFrameworkNameProvider(profileCollection))
 {
 }