示例#1
0
 public void Add(
     string name,
     ImmutableArray <byte> publicKeyToken,
     AssemblyVersion version)
 {
     Add(name, new Value(publicKeyToken, version));
 }
示例#2
0
            public bool TryGetValue(AssemblyIdentity identity, out Value value)
            {
                if (!TryGetValue(new Key(identity.Name, identity.PublicKeyToken), out List <Value> values))
                {
                    value = default(Value);
                    return(false);
                }

                for (int i = 0; i < values.Count; i++)
                {
                    value = values[i];
                    AssemblyVersion version = (AssemblyVersion)identity.Version;
                    if (value.VersionHigh.Major == 0)
                    {
                        Debug.Assert(value.VersionHigh == default(AssemblyVersion));
                        if (version == value.VersionLow)
                        {
                            return(true);
                        }
                    }
                    else if (version >= value.VersionLow && version <= value.VersionHigh)
                    {
                        return(true);
                    }
                }

                value = default(Value);
                return(false);
            }
示例#3
0
        private AssemblyIdentity Port(AssemblyIdentity identity)
        {
            if (identity.IsRetargetable || !identity.IsStrongName || identity.ContentType != AssemblyContentType.Default)
            {
                return(identity);
            }

            Version newVersion = null;
            ImmutableArray <byte> newPublicKeyToken = default(ImmutableArray <byte>);

            AssemblyVersion version = (AssemblyVersion)identity.Version;

            if (version >= new AssemblyVersion(2, 0, 0, 0) && version <= new AssemblyVersion(5, 9, 0, 0))
            {
                if (identity.PublicKeyToken.SequenceEqual(s_SILVERLIGHT_PLATFORM_PUBLICKEY_STR_L))
                {
                    if (!policy.SuppressSilverlightPlatformAssembliesPortability)
                    {
                        if (SimpleNameComparer.Equals(identity.Name, "System") ||
                            SimpleNameComparer.Equals(identity.Name, "System.Core"))
                        {
                            newVersion        = (Version)s_VER_ASSEMBLYVERSION_STR_L;
                            newPublicKeyToken = s_ECMA_PUBLICKEY_STR_L;
                        }
                    }
                }
                else if (identity.PublicKeyToken.SequenceEqual(s_SILVERLIGHT_PUBLICKEY_STR_L))
                {
                    if (!policy.SuppressSilverlightLibraryAssembliesPortability)
                    {
                        if (SimpleNameComparer.Equals(identity.Name, "Microsoft.VisualBasic"))
                        {
                            newVersion        = new Version(10, 0, 0, 0);
                            newPublicKeyToken = s_MICROSOFT_PUBLICKEY_STR_L;
                        }

                        if (SimpleNameComparer.Equals(identity.Name, "System.ComponentModel.Composition"))
                        {
                            newVersion        = (Version)s_VER_ASSEMBLYVERSION_STR_L;
                            newPublicKeyToken = s_ECMA_PUBLICKEY_STR_L;
                        }
                    }
                }
            }

            if (newVersion == null)
            {
                return(identity);
            }

            return(new AssemblyIdentity(
                       identity.Name,
                       newVersion,
                       identity.CultureName,
                       newPublicKeyToken,
                       hasPublicKey: false,
                       isRetargetable: identity.IsRetargetable,
                       contentType: AssemblyContentType.Default));
        }
示例#4
0
 public Value(
     AssemblyVersion versionLow,
     AssemblyVersion versionHigh,
     string newName,
     ImmutableArray <byte> newPublicKeyToken,
     AssemblyVersion newVersion,
     bool isPortable)
 {
     VersionLow        = versionLow;
     VersionHigh       = versionHigh;
     NewName           = newName;
     NewPublicKeyToken = newPublicKeyToken;
     NewVersion        = newVersion;
     IsPortable        = isPortable;
 }
            public void Add(
                string name,
                ImmutableArray <byte> publicKeyToken,
                AssemblyVersion versionLow,
                object versionHighNull,
                string newName,
                ImmutableArray <byte> newPublicKeyToken,
                AssemblyVersion newVersion)
            {
                List <Value>?values;
                var          key = new Key(name, publicKeyToken);

                if (!TryGetValue(key, out values))
                {
                    Add(key, values = new List <Value>());
                }

                values.Add(new Value(versionLow, versionHigh: default, newName, newPublicKeyToken, newVersion, isPortable: false));
示例#6
0
            public void Add(
                string name,
                ImmutableArray <byte> publicKeyToken,
                AssemblyVersion versionLow,
                AssemblyVersion versionHigh,
                string newName,
                ImmutableArray <byte> newPublicKeyToken,
                AssemblyVersion newVersion,
                bool isPortable)
            {
                Key key = new Key(name, publicKeyToken);

                if (!TryGetValue(key, out List <Value> values))
                {
                    Add(key, values = new List <Value>());
                }

                values.Add(new Value(versionLow, versionHigh, newName, newPublicKeyToken, newVersion, isPortable));
            }
示例#7
0
 public Value(ImmutableArray <byte> publicKeyToken, AssemblyVersion version)
 {
     this.PublicKeyToken = publicKeyToken;
     this.Version        = version;
 }