예제 #1
0
        static bool IsFrameworkAssembly(ParsedAssemblyName name)
        {
            // A list of FX assemblies which require some form of remapping
            // When 4.0 + 1 version  is release, assemblies introduced in v4.0
            // will have to be added
            switch (name.Name)
            {
            case "System":
            case "System.Core":
            case "System.Data":
            case "System.Data.DataSetExtensions":
            case "System.Data.Linq":
            case "System.Data.OracleClient":
            case "System.Data.Services":
            case "System.Data.Services.Client":
            case "System.IdentityModel":
            case "System.IdentityModel.Selectors":
            case "System.Runtime.Remoting":
            case "System.Runtime.Serialization":
            case "System.ServiceModel":
            case "System.Transactions":
            case "System.Windows.Forms":
            case "System.Xml":
            case "System.Xml.Linq":
                return(name.PublicKeyToken == "b77a5c561934e089");

            case "System.Configuration":
            case "System.Configuration.Install":
            case "System.Design":
            case "System.DirectoryServices":
            case "System.Drawing":
            case "System.Drawing.Design":
            case "System.EnterpriseServices":
            case "System.Management":
            case "System.Messaging":
            case "System.Runtime.Serialization.Formatters.Soap":
            case "System.Security":
            case "System.ServiceProcess":
            case "System.Web":
            case "System.Web.Mobile":
            case "System.Web.Services":
                return(name.PublicKeyToken == "b03f5f7f11d50a3a");

            case "System.ComponentModel.DataAnnotations":
            case "System.ServiceModel.Web":
            case "System.Web.Abstractions":
            case "System.Web.Extensions":
            case "System.Web.Extensions.Design":
            case "System.Web.DynamicData":
            case "System.Web.Routing":
                return(name.PublicKeyToken == "31bf3856ad364e35");
            }

            return(false);
        }
예제 #2
0
        static bool IsFacadeAssembly(ParsedAssemblyName name)
        {
            switch (name.Name)
            {
            case "System.Collections":
            case "System.Collections.Concurrent":
            case "System.ComponentModel":
            case "System.ComponentModel.Annotations":
            case "System.ComponentModel.EventBasedAsync":
            case "System.Diagnostics.Contracts":
            case "System.Diagnostics.Debug":
            case "System.Diagnostics.Tools":
            case "System.Dynamic.Runtime":
            case "System.Globalization":
            case "System.IO":
            case "System.Linq":
            case "System.Linq.Expressions":
            case "System.Linq.Parallel":
            case "System.Linq.Queryable":
            case "System.Net.NetworkInformation":
            case "System.Net.Primitives":
            case "System.Net.Requests":
            case "System.ObjectModel":
            case "System.Reflection":
            case "System.Reflection.Extensions":
            case "System.Reflection.Primitives":
            case "System.Resources.ResourceManager":
            case "System.Runtime":
            case "System.Runtime.Extensions":
            case "System.Runtime.InteropServices":
            case "System.Runtime.Numerics":
            case "System.Runtime.Serialization.Json":
            case "System.Runtime.Serialization.Primitives":
            case "System.Runtime.Serialization.Xml":
            case "System.Security.Principal":
            case "System.ServiceModel.Http":
            case "System.ServiceModel.Primitives":
            case "System.Text.Encoding":
            case "System.Text.Encoding.Extensions":
            case "System.Text.RegularExpressions":
            case "System.Threading":
            case "System.Threading.Tasks":
            case "System.Threading.Tasks.Parallel":
            case "System.Xml.ReaderWriter":
            case "System.Xml.XDocument":
            case "System.Xml.XmlSerializer":
                return(name.PublicKeyToken == "b03f5f7f11d50a3a");

            default:
                return(false);
            }
        }
예제 #3
0
        static bool HasPclRuntimeRemapping(ParsedAssemblyName name1, ParsedAssemblyName name2)
        {
            if (name1.Name != name2.Name)
            {
                return(false);
            }

            for (int i = 0; i < key_remap_table.GetLength(0); i++)
            {
                if (!name1.Name.Equals(key_remap_table [i, 0]))
                {
                    continue;
                }
                if (name1.PublicKeyToken.Equals(key_remap_table [i, 1]) &&
                    name2.PublicKeyToken.Equals(key_remap_table [i, 2]))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #4
0
파일: Fusion.cs 프로젝트: zgramana/ikvm
        static bool IsFrameworkAssembly(ParsedAssemblyName name)
        {
            // Framework assemblies use different unification rules, so when
            // a new framework is released the new assemblies need to be added.
            switch (name.Name)
            {
            case "System":
            case "System.Core":
            case "System.Data":
            case "System.Data.DataSetExtensions":
            case "System.Data.Linq":
            case "System.Data.OracleClient":
            case "System.Data.Services":
            case "System.Data.Services.Client":
            case "System.IdentityModel":
            case "System.IdentityModel.Selectors":
            case "System.IO.Compression":
            case "System.Numerics":
            case "System.Reflection.Context":
            case "System.Runtime.Remoting":
            case "System.Runtime.Serialization":
            case "System.Runtime.WindowsRuntime":
            case "System.Runtime.WindowsRuntime.UI.Xaml":
            case "System.ServiceModel":
            case "System.Transactions":
            case "System.Windows.Forms":
            case "System.Xml":
            case "System.Xml.Linq":
            case "System.Xml.Serialization":
                return(name.PublicKeyToken == PublicKeyTokenEcma);

            case "Microsoft.CSharp":
            case "Microsoft.VisualBasic":
            case "System.Collections":
            case "System.Collections.Concurrent":
            case "System.ComponentModel":
            case "System.ComponentModel.Annotations":
            case "System.ComponentModel.EventBasedAsync":
            case "System.Configuration":
            case "System.Configuration.Install":
            case "System.Design":
            case "System.Diagnostics.Contracts":
            case "System.Diagnostics.Debug":
            case "System.Diagnostics.Tools":
            case "System.Diagnostics.Tracing":
            case "System.DirectoryServices":
            case "System.Drawing":
            case "System.Drawing.Design":
            case "System.Dynamic.Runtime":
            case "System.EnterpriseServices":
            case "System.Globalization":
            case "System.IO":
            case "System.Linq":
            case "System.Linq.Expressions":
            case "System.Linq.Parallel":
            case "System.Linq.Queryable":
            case "System.Management":
            case "System.Messaging":
            case "System.Net":
            case "System.Net.Http":
            case "System.Net.Http.Rtc":
            case "System.Net.NetworkInformation":
            case "System.Net.Primitives":
            case "System.Net.Requests":
            case "System.ObjectModel":
            case "System.Reflection":
            case "System.Reflection.Extensions":
            case "System.Reflection.Primitives":
            case "System.Resources.ResourceManager":
            case "System.Runtime":
            case "System.Runtime.Extensions":
            case "System.Runtime.InteropServices":
            case "System.Runtime.InteropServices.WindowsRuntime":
            case "System.Runtime.Numerics":
            case "System.Runtime.Serialization.Formatters.Soap":
            case "System.Runtime.Serialization.Json":
            case "System.Runtime.Serialization.Primitives":
            case "System.Runtime.Serialization.Xml":
            case "System.Security":
            case "System.Security.Principal":
            case "System.ServiceModel.Duplex":
            case "System.ServiceModel.Http":
            case "System.ServiceModel.NetTcp":
            case "System.ServiceModel.Primitives":
            case "System.ServiceModel.Security":
            case "System.ServiceProcess":
            case "System.Text.Encoding":
            case "System.Text.Encoding.Extensions":
            case "System.Text.RegularExpressions":
            case "System.Threading":
            case "System.Threading.Tasks":
            case "System.Threading.Tasks.Parallel":
            case "System.Web":
            case "System.Web.Mobile":
            case "System.Web.Services":
            case "System.Windows":
            case "System.Xml.ReaderWriter":
            case "System.Xml.XDocument":
            case "System.Xml.XmlSerializer":
                return(name.PublicKeyToken == PublicKeyTokenMicrosoft);

            case "System.ComponentModel.DataAnnotations":
            case "System.ServiceModel.Web":
            case "System.Web.Abstractions":
            case "System.Web.Extensions":
            case "System.Web.Extensions.Design":
            case "System.Web.DynamicData":
            case "System.Web.Routing":
                return(name.PublicKeyToken == PublicKeyTokenWinFX);
            }

            return(false);
        }
예제 #5
0
        // note that this is the fusion specific parser, it is not the same as System.Reflection.AssemblyName
        private static bool ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
        {
            parsedName = new ParsedAssemblyName();
            StringBuilder sb  = new StringBuilder();
            int           pos = 0;

            while (pos < fullName.Length)
            {
                char ch = fullName[pos++];
                if (ch == '\\')
                {
                    if (pos == fullName.Length)
                    {
                        return(false);
                    }
                    ch = fullName[pos++];
                }
                else if (ch == ',')
                {
                    break;
                }
                sb.Append(ch);
            }
            parsedName.Name = sb.ToString().Trim();
            if (pos < fullName.Length)
            {
                string[] parts = fullName.Substring(pos).Split(',');
                for (int i = 0; i < parts.Length; i++)
                {
                    string[] kv = parts[i].Split('=');
                    if (kv.Length != 2)
                    {
                        return(false);
                    }
                    switch (kv[0].Trim().ToLowerInvariant())
                    {
                    case "version":
                        if (parsedName.Version != null)
                        {
                            return(false);
                        }
                        if (!ParseVersion(kv[1].Trim(), out parsedName.Version))
                        {
                            return(false);
                        }
                        break;

                    case "culture":
                        if (parsedName.Culture != null)
                        {
                            return(false);
                        }
                        if (!ParseCulture(kv[1].Trim(), out parsedName.Culture))
                        {
                            return(false);
                        }
                        break;

                    case "publickeytoken":
                        if (parsedName.PublicKeyToken != null)
                        {
                            return(false);
                        }
                        if (!ParsePublicKeyToken(kv[1].Trim(), out parsedName.PublicKeyToken))
                        {
                            return(false);
                        }
                        break;

                    case "publickey":
                        if (parsedName.PublicKeyToken != null)
                        {
                            return(false);
                        }
                        if (!ParsePublicKey(kv[1].Trim(), out parsedName.PublicKeyToken))
                        {
                            return(false);
                        }
                        break;
                    }
                }
            }
            return(true);
        }
예제 #6
0
		private static bool IsStrongNamed(ParsedAssemblyName name)
		{
			return name.PublicKeyToken != null && name.PublicKeyToken != "null";
		}
예제 #7
0
		private static bool IsPartial(ParsedAssemblyName name, Version version)
		{
			return version == null || name.Culture == null || name.PublicKeyToken == null;
		}
예제 #8
0
		internal static ParseAssemblyResult ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
		{
			parsedName = new ParsedAssemblyName();
			int pos;
			ParseAssemblyResult res = ParseAssemblySimpleName(fullName, out pos, out parsedName.Name);
			if (res != ParseAssemblyResult.OK)
			{
				return res;
			}
			else
			{
				const int ERROR_SXS_IDENTITIES_DIFFERENT = unchecked((int)0x80073716);
				System.Collections.Generic.Dictionary<string, string> unknownAttributes = null;
				bool hasProcessorArchitecture = false;
				bool hasContentType = false;
				bool hasPublicKeyToken = false;
				string publicKeyToken;
				while (pos != fullName.Length)
				{
					string key = null;
					string value = null;
					if (!TryParseAssemblyAttribute(fullName, ref pos, ref key, ref value))
					{
						return ParseAssemblyResult.GenericError;
					}
					key = key.ToLowerInvariant();
					switch (key)
					{
						case "version":
							if (parsedName.Version != null)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							parsedName.Version = value;
							break;
						case "culture":
							if (parsedName.Culture != null)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							if (!ParseCulture(value, out parsedName.Culture))
							{
								return ParseAssemblyResult.GenericError;
							}
							break;
						case "publickeytoken":
							if (hasPublicKeyToken)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							if (!ParsePublicKeyToken(value, out publicKeyToken))
							{
								return ParseAssemblyResult.GenericError;
							}
							if (parsedName.HasPublicKey && parsedName.PublicKeyToken != publicKeyToken)
							{
								Marshal.ThrowExceptionForHR(ERROR_SXS_IDENTITIES_DIFFERENT);
							}
							parsedName.PublicKeyToken = publicKeyToken;
							hasPublicKeyToken = true;
							break;
						case "publickey":
							if (parsedName.HasPublicKey)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							if (!ParsePublicKey(value, out publicKeyToken))
							{
								return ParseAssemblyResult.GenericError;
							}
							if (hasPublicKeyToken && parsedName.PublicKeyToken != publicKeyToken)
							{
								Marshal.ThrowExceptionForHR(ERROR_SXS_IDENTITIES_DIFFERENT);
							}
							parsedName.PublicKeyToken = publicKeyToken;
							parsedName.HasPublicKey = true;
							break;
						case "retargetable":
							if (parsedName.Retargetable.HasValue)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							switch (value.ToLowerInvariant())
							{
								case "yes":
									parsedName.Retargetable = true;
									break;
								case "no":
									parsedName.Retargetable = false;
									break;
								default:
									return ParseAssemblyResult.GenericError;
							}
							break;
						case "processorarchitecture":
							if (hasProcessorArchitecture)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							hasProcessorArchitecture = true;
							switch (value.ToLowerInvariant())
							{
								case "none":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.None;
									break;
								case "msil":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.MSIL;
									break;
								case "x86":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.X86;
									break;
								case "ia64":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.IA64;
									break;
								case "amd64":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.Amd64;
									break;
								case "arm":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.Arm;
									break;
								default:
									return ParseAssemblyResult.GenericError;
							}
							break;
						case "contenttype":
							if (hasContentType)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							hasContentType = true;
							if (!value.Equals("windowsruntime", StringComparison.OrdinalIgnoreCase))
							{
								return ParseAssemblyResult.GenericError;
							}
							parsedName.WindowsRuntime = true;
							break;
						default:
							if (key.Length == 0)
							{
								return ParseAssemblyResult.GenericError;
							}
							if (unknownAttributes == null)
							{
								unknownAttributes = new System.Collections.Generic.Dictionary<string, string>();
							}
							if (unknownAttributes.ContainsKey(key))
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							unknownAttributes.Add(key, null);
							break;
					}
				}
				return ParseAssemblyResult.OK;
			}
		}
예제 #9
0
파일: Fusion.cs 프로젝트: zgramana/ikvm
 private static bool IsPartial(ParsedAssemblyName name, Version version)
 {
     return(version == null || name.Culture == null || name.PublicKeyToken == null);
 }
예제 #10
0
        internal static ParseAssemblyResult ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
        {
            parsedName = new ParsedAssemblyName();
            int pos;
            ParseAssemblyResult res = ParseAssemblySimpleName(fullName, out pos, out parsedName.Name);

            if (res != ParseAssemblyResult.OK || pos == fullName.Length)
            {
                return(res);
            }
            else
            {
                System.Collections.Generic.Dictionary <string, string> unknownAttributes = null;
                bool     hasProcessorArchitecture = false;
                string[] parts = fullName.Substring(pos).Split(',');
                for (int i = 0; i < parts.Length; i++)
                {
                    string[] kv = parts[i].Split('=');
                    if (kv.Length != 2)
                    {
                        return(ParseAssemblyResult.GenericError);
                    }
                    switch (kv[0].Trim().ToLowerInvariant())
                    {
                    case "version":
                        if (parsedName.Version != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParseVersion(kv[1].Trim(), out parsedName.Version))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "culture":
                        if (parsedName.Culture != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParseCulture(kv[1].Trim(), out parsedName.Culture))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "publickeytoken":
                        if (parsedName.PublicKeyToken != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParsePublicKeyToken(kv[1].Trim(), out parsedName.PublicKeyToken))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "publickey":
                        if (parsedName.PublicKeyToken != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParsePublicKey(kv[1].Trim(), out parsedName.PublicKeyToken))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        parsedName.HasPublicKey = true;
                        break;

                    case "retargetable":
                        if (parsedName.Retargetable.HasValue)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        switch (kv[1].Trim().ToLowerInvariant())
                        {
                        case "yes":
                            parsedName.Retargetable = true;
                            break;

                        case "no":
                            parsedName.Retargetable = false;
                            break;

                        default:
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "processorarchitecture":
                        if (hasProcessorArchitecture)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        hasProcessorArchitecture = true;
                        switch (kv[1].Trim().ToLowerInvariant())
                        {
                        case "none":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.None;
                            break;

                        case "msil":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.MSIL;
                            break;

                        case "x86":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.X86;
                            break;

                        case "ia64":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.IA64;
                            break;

                        case "amd64":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.Amd64;
                            break;

                        case "arm":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.Arm;
                            break;

                        default:
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    default:
                        if (kv[1].Trim() == "")
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        if (unknownAttributes == null)
                        {
                            unknownAttributes = new System.Collections.Generic.Dictionary <string, string>();
                        }
                        if (unknownAttributes.ContainsKey(kv[0].Trim().ToLowerInvariant()))
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        unknownAttributes.Add(kv[0].Trim().ToLowerInvariant(), null);
                        break;
                    }
                }
            }
            return(ParseAssemblyResult.OK);
        }
예제 #11
0
파일: Fusion.cs 프로젝트: xiaochuwang/mono
        internal static ParseAssemblyResult ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
        {
            parsedName = new ParsedAssemblyName();
            StringBuilder sb  = new StringBuilder();
            int           pos = 0;

            while (pos < fullName.Length && char.IsWhiteSpace(fullName[pos]))
            {
                pos++;
            }
            char quoteOrComma = ',';

            if (pos < fullName.Length && (fullName[pos] == '\"' || fullName[pos] == '\''))
            {
                quoteOrComma = fullName[pos++];
            }
            while (pos < fullName.Length)
            {
                char ch = fullName[pos++];
                if (ch == '\\')
                {
                    if (pos == fullName.Length)
                    {
                        return(ParseAssemblyResult.GenericError);
                    }
                    ch = fullName[pos++];
                    if (ch == '\\')
                    {
                        return(ParseAssemblyResult.GenericError);
                    }
                }
                else if (ch == quoteOrComma)
                {
                    if (ch != ',')
                    {
                        while (pos != fullName.Length)
                        {
                            ch = fullName[pos++];
                            if (ch == ',')
                            {
                                break;
                            }
                            if (!char.IsWhiteSpace(ch))
                            {
                                return(ParseAssemblyResult.GenericError);
                            }
                        }
                    }
                    break;
                }
                else if (ch == '=' || (quoteOrComma == ',' && (ch == '\'' || ch == '"')))
                {
                    return(ParseAssemblyResult.GenericError);
                }
                sb.Append(ch);
            }
            parsedName.Name = sb.ToString().Trim();
            if (parsedName.Name.Length == 0)
            {
                return(ParseAssemblyResult.GenericError);
            }
            if (pos == fullName.Length)
            {
                return(fullName[fullName.Length - 1] != ',' ? ParseAssemblyResult.OK : ParseAssemblyResult.GenericError);
            }
            else
            {
                System.Collections.Generic.Dictionary <string, string> unknownAttributes = null;
                bool     hasProcessorArchitecture = false;
                string[] parts = fullName.Substring(pos).Split(',');
                for (int i = 0; i < parts.Length; i++)
                {
                    string[] kv = parts[i].Split('=');
                    if (kv.Length != 2)
                    {
                        return(ParseAssemblyResult.GenericError);
                    }
                    switch (kv[0].Trim().ToLowerInvariant())
                    {
                    case "version":
                        if (parsedName.Version != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParseVersion(kv[1].Trim(), out parsedName.Version))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "culture":
                        if (parsedName.Culture != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParseCulture(kv[1].Trim(), out parsedName.Culture))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "publickeytoken":
                        if (parsedName.PublicKeyToken != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParsePublicKeyToken(kv[1].Trim(), out parsedName.PublicKeyToken))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "publickey":
                        if (parsedName.PublicKeyToken != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParsePublicKey(kv[1].Trim(), out parsedName.PublicKeyToken))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        parsedName.HasPublicKey = true;
                        break;

                    case "retargetable":
                        if (parsedName.Retargetable.HasValue)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        switch (kv[1].Trim().ToLowerInvariant())
                        {
                        case "yes":
                            parsedName.Retargetable = true;
                            break;

                        case "no":
                            parsedName.Retargetable = false;
                            break;

                        default:
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "processorarchitecture":
                        if (hasProcessorArchitecture)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        hasProcessorArchitecture = true;
                        switch (kv[1].Trim().ToLowerInvariant())
                        {
                        case "none":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.None;
                            break;

                        case "msil":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.MSIL;
                            break;

                        case "x86":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.X86;
                            break;

                        case "ia64":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.IA64;
                            break;

                        case "amd64":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.Amd64;
                            break;

                        case "arm":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.Arm;
                            break;

                        default:
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    default:
                        if (kv[1].Trim() == "")
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        if (unknownAttributes == null)
                        {
                            unknownAttributes = new System.Collections.Generic.Dictionary <string, string>();
                        }
                        if (unknownAttributes.ContainsKey(kv[0].Trim().ToLowerInvariant()))
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        unknownAttributes.Add(kv[0].Trim().ToLowerInvariant(), null);
                        break;
                    }
                }
            }
            return(ParseAssemblyResult.OK);
        }
예제 #12
0
        static bool IsFrameworkAssembly(ParsedAssemblyName name)
        {
            // A list of FX assemblies which require some form of remapping
            // When 4.0 + 1 version  is release, assemblies introduced in v4.0
            // will have to be added
            switch (name.Name)
            {
                case "System":
                case "System.Core":
                case "System.Data":
                case "System.Data.DataSetExtensions":
                case "System.Data.Linq":
                case "System.Data.OracleClient":
                case "System.Data.Services":
                case "System.Data.Services.Client":
                case "System.IdentityModel":
                case "System.IdentityModel.Selectors":
                case "System.Runtime.Remoting":
                case "System.Runtime.Serialization":
                case "System.ServiceModel":
                case "System.Transactions":
                case "System.Windows.Forms":
                case "System.Xml":
                case "System.Xml.Linq":
                    return name.PublicKeyToken == "b77a5c561934e089";

                case "System.Configuration":
                case "System.Configuration.Install":
                case "System.Design":
                case "System.DirectoryServices":
                case "System.Drawing":
                case "System.Drawing.Design":
                case "System.EnterpriseServices":
                case "System.Management":
                case "System.Messaging":
                case "System.Runtime.Serialization.Formatters.Soap":
                case "System.Security":
                case "System.ServiceProcess":
                case "System.Web":
                case "System.Web.Mobile":
                case "System.Web.Services":
                    return name.PublicKeyToken == "b03f5f7f11d50a3a";

                case "System.ComponentModel.DataAnnotations":
                case "System.ServiceModel.Web":
                case "System.Web.Abstractions":
                case "System.Web.Extensions":
                case "System.Web.Extensions.Design":
                case "System.Web.DynamicData":
                case "System.Web.Routing":
                    return name.PublicKeyToken == "31bf3856ad364e35";
            }

            return false;
        }
예제 #13
0
 internal static ParseAssemblyResult ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
 {
     parsedName = new ParsedAssemblyName();
     int pos;
     ParseAssemblyResult res = ParseAssemblySimpleName(fullName, out pos, out parsedName.Name);
     if (res != ParseAssemblyResult.OK || pos == fullName.Length)
     {
         return res;
     }
     else
     {
         System.Collections.Generic.Dictionary<string, string> unknownAttributes = null;
         bool hasProcessorArchitecture = false;
         bool hasContentType = false;
         string[] parts = fullName.Substring(pos).Split(',');
         for (int i = 0; i < parts.Length; i++)
         {
             string[] kv = parts[i].Split('=');
             if (kv.Length != 2)
             {
                 return ParseAssemblyResult.GenericError;
             }
             switch (kv[0].Trim().ToLowerInvariant())
             {
                 case "version":
                     if (parsedName.Version != null)
                     {
                         return ParseAssemblyResult.DuplicateKey;
                     }
                     if (!ParseVersion(kv[1].Trim(), out parsedName.Version))
                     {
                         return ParseAssemblyResult.GenericError;
                     }
                     break;
                 case "culture":
                     if (parsedName.Culture != null)
                     {
                         return ParseAssemblyResult.DuplicateKey;
                     }
                     if (!ParseCulture(kv[1].Trim(), out parsedName.Culture))
                     {
                         return ParseAssemblyResult.GenericError;
                     }
                     break;
                 case "publickeytoken":
                     if (parsedName.PublicKeyToken != null)
                     {
                         return ParseAssemblyResult.DuplicateKey;
                     }
                     if (!ParsePublicKeyToken(kv[1].Trim(), out parsedName.PublicKeyToken))
                     {
                         return ParseAssemblyResult.GenericError;
                     }
                     break;
                 case "publickey":
                     if (parsedName.PublicKeyToken != null)
                     {
                         return ParseAssemblyResult.DuplicateKey;
                     }
                     if (!ParsePublicKey(kv[1].Trim(), out parsedName.PublicKeyToken))
                     {
                         return ParseAssemblyResult.GenericError;
                     }
                     parsedName.HasPublicKey = true;
                     break;
                 case "retargetable":
                     if (parsedName.Retargetable.HasValue)
                     {
                         return ParseAssemblyResult.DuplicateKey;
                     }
                     switch (kv[1].Trim().ToLowerInvariant())
                     {
                         case "yes":
                             parsedName.Retargetable = true;
                             break;
                         case "no":
                             parsedName.Retargetable = false;
                             break;
                         default:
                             return ParseAssemblyResult.GenericError;
                     }
                     break;
                 case "processorarchitecture":
                     if (hasProcessorArchitecture)
                     {
                         return ParseAssemblyResult.DuplicateKey;
                     }
                     hasProcessorArchitecture = true;
                     switch (kv[1].Trim().ToLowerInvariant())
                     {
                         case "none":
                             parsedName.ProcessorArchitecture = ProcessorArchitecture.None;
                             break;
                         case "msil":
                             parsedName.ProcessorArchitecture = ProcessorArchitecture.MSIL;
                             break;
                         case "x86":
                             parsedName.ProcessorArchitecture = ProcessorArchitecture.X86;
                             break;
                         case "ia64":
                             parsedName.ProcessorArchitecture = ProcessorArchitecture.IA64;
                             break;
                         case "amd64":
                             parsedName.ProcessorArchitecture = ProcessorArchitecture.Amd64;
                             break;
                         case "arm":
                             parsedName.ProcessorArchitecture = ProcessorArchitecture.Arm;
                             break;
                         default:
                             return ParseAssemblyResult.GenericError;
                     }
                     break;
                 case "contenttype":
                     if (hasContentType)
                     {
                         return ParseAssemblyResult.DuplicateKey;
                     }
                     hasContentType = true;
                     if (kv[1].Trim().ToLowerInvariant() != "windowsruntime")
                     {
                         return ParseAssemblyResult.GenericError;
                     }
                     parsedName.WindowsRuntime = true;
                     break;
                 default:
                     if (kv[1].Trim() == "")
                     {
                         return ParseAssemblyResult.GenericError;
                     }
                     if (unknownAttributes == null)
                     {
                         unknownAttributes = new System.Collections.Generic.Dictionary<string, string>();
                     }
                     if (unknownAttributes.ContainsKey(kv[0].Trim().ToLowerInvariant()))
                     {
                         return ParseAssemblyResult.DuplicateKey;
                     }
                     unknownAttributes.Add(kv[0].Trim().ToLowerInvariant(), null);
                     break;
             }
         }
     }
     return ParseAssemblyResult.OK;
 }
		internal static ParseAssemblyResult ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
		{
			parsedName = new ParsedAssemblyName();
			StringBuilder sb = new StringBuilder();
			int pos = 0;
			while (pos < fullName.Length && char.IsWhiteSpace(fullName[pos]))
			{
				pos++;
			}
			char quoteOrComma = ',';
			if (pos < fullName.Length && (fullName[pos] == '\"' || fullName[pos] == '\''))
			{
				quoteOrComma = fullName[pos++];
			}
			while (pos < fullName.Length)
			{
				char ch = fullName[pos++];
				if (ch == '\\')
				{
					if (pos == fullName.Length)
					{
						return ParseAssemblyResult.GenericError;
					}
					ch = fullName[pos++];
					if (ch == '\\')
					{
						return ParseAssemblyResult.GenericError;
					}
				}
				else if (ch == quoteOrComma)
				{
					if (ch != ',')
					{
						while (pos != fullName.Length)
						{
							ch = fullName[pos++];
							if (ch == ',')
							{
								break;
							}
							if (!char.IsWhiteSpace(ch))
							{
								return ParseAssemblyResult.GenericError;
							}
						}
					}
					break;
				}
				else if (ch == '=' || (quoteOrComma == ',' && (ch == '\'' || ch == '"')))
				{
					return ParseAssemblyResult.GenericError;
				}
				sb.Append(ch);
			}
			parsedName.Name = sb.ToString().Trim();
			if (parsedName.Name.Length == 0)
			{
				return ParseAssemblyResult.GenericError;
			}
			if (pos == fullName.Length)
			{
				return fullName[fullName.Length - 1] != ',' ? ParseAssemblyResult.OK : ParseAssemblyResult.GenericError;
			}
			else
			{
				System.Collections.Generic.Dictionary<string, string> unknownAttributes = null;
				bool hasProcessorArchitecture = false;
				string[] parts = fullName.Substring(pos).Split(',');
				for (int i = 0; i < parts.Length; i++)
				{
					string[] kv = parts[i].Split('=');
					if (kv.Length != 2)
					{
						return ParseAssemblyResult.GenericError;
					}
					switch (kv[0].Trim().ToLowerInvariant())
					{
						case "version":
							if (parsedName.Version != null)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							if (!ParseVersion(kv[1].Trim(), out parsedName.Version))
							{
								return ParseAssemblyResult.GenericError;
							}
							break;
						case "culture":
							if (parsedName.Culture != null)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							if (!ParseCulture(kv[1].Trim(), out parsedName.Culture))
							{
								return ParseAssemblyResult.GenericError;
							}
							break;
						case "publickeytoken":
							if (parsedName.PublicKeyToken != null)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							if (!ParsePublicKeyToken(kv[1].Trim(), out parsedName.PublicKeyToken))
							{
								return ParseAssemblyResult.GenericError;
							}
							break;
						case "publickey":
							if (parsedName.PublicKeyToken != null)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							if (!ParsePublicKey(kv[1].Trim(), out parsedName.PublicKeyToken))
							{
								return ParseAssemblyResult.GenericError;
							}
							break;
						case "retargetable":
							if (parsedName.Retargetable.HasValue)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							switch (kv[1].Trim().ToLowerInvariant())
							{
								case "yes":
									parsedName.Retargetable = true;
									break;
								case "no":
									parsedName.Retargetable = false;
									break;
								default:
									return ParseAssemblyResult.GenericError;
							}
							break;
						case "processorarchitecture":
							if (hasProcessorArchitecture)
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							hasProcessorArchitecture = true;
							switch (kv[1].Trim().ToLowerInvariant())
							{
								case "none":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.None;
									break;
								case "msil":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.MSIL;
									break;
								case "x86":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.X86;
									break;
								case "ia64":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.IA64;
									break;
								case "amd64":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.Amd64;
									break;
								case "arm":
									parsedName.ProcessorArchitecture = ProcessorArchitecture.Arm;
									break;
								default:
									return ParseAssemblyResult.GenericError;
							}
							break;
						default:
							if (kv[1].Trim() == "")
							{
								return ParseAssemblyResult.GenericError;
							}
							if (unknownAttributes == null)
							{
								unknownAttributes = new System.Collections.Generic.Dictionary<string, string>();
							}
							if (unknownAttributes.ContainsKey(kv[0].Trim().ToLowerInvariant()))
							{
								return ParseAssemblyResult.DuplicateKey;
							}
							unknownAttributes.Add(kv[0].Trim().ToLowerInvariant(), null);
							break;
					}
				}
			}
			return ParseAssemblyResult.OK;
		}
예제 #15
0
파일: Fusion.cs 프로젝트: koush/mono
		// note that this is the fusion specific parser, it is not the same as System.Reflection.AssemblyName
		private static bool ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
		{
			parsedName = new ParsedAssemblyName();
			StringBuilder sb = new StringBuilder();
			int pos = 0;
			while (pos < fullName.Length)
			{
				char ch = fullName[pos++];
				if (ch == '\\')
				{
					if (pos == fullName.Length)
					{
						return false;
					}
					ch = fullName[pos++];
				}
				else if (ch == ',')
				{
					break;
				}
				sb.Append(ch);
			}
			parsedName.Name = sb.ToString().Trim();
			if (pos < fullName.Length)
			{
				string[] parts = fullName.Substring(pos).Split(',');
				for (int i = 0; i < parts.Length; i++)
				{
					string[] kv = parts[i].Split('=');
					if (kv.Length != 2)
					{
						return false;
					}
					switch (kv[0].Trim().ToLowerInvariant())
					{
						case "version":
							if (parsedName.Version != null)
							{
								return false;
							}
							if (!ParseVersion(kv[1].Trim(), out parsedName.Version))
							{
								return false;
							}
							break;
						case "culture":
							if (parsedName.Culture != null)
							{
								return false;
							}
							if (!ParseCulture(kv[1].Trim(), out parsedName.Culture))
							{
								return false;
							}
							break;
						case "publickeytoken":
							if (parsedName.PublicKeyToken != null)
							{
								return false;
							}
							if (!ParsePublicKeyToken(kv[1].Trim(), out parsedName.PublicKeyToken))
							{
								return false;
							}
							break;
						case "publickey":
							if (parsedName.PublicKeyToken != null)
							{
								return false;
							}
							if (!ParsePublicKey(kv[1].Trim(), out parsedName.PublicKeyToken))
							{
								return false;
							}
							break;
					}
				}
			}
			return true;
		}
예제 #16
0
파일: Fusion.cs 프로젝트: zgramana/ikvm
        static string GetRemappedPublicKeyToken(ref ParsedAssemblyName name, Version version)
        {
            if (name.Retargetable.GetValueOrDefault() && version < SilverlightVersion)
            {
                return(null);
            }
            if (name.PublicKeyToken == "ddd0da4d3e678217" && name.Name == "System.ComponentModel.DataAnnotations" && name.Retargetable.GetValueOrDefault())
            {
                return(PublicKeyTokenWinFX);
            }
            if (SilverlightVersionMinimum <= version && version <= SilverlightVersionMaximum)
            {
                switch (name.PublicKeyToken)
                {
                case PublicKeyTokenSilverlight:
                    switch (name.Name)
                    {
                    case "System":
                    case "System.Core":
                        return(PublicKeyTokenEcma);
                    }
                    if (name.Retargetable.GetValueOrDefault())
                    {
                        switch (name.Name)
                        {
                        case "System.Runtime.Serialization":
                        case "System.Xml":
                            return(PublicKeyTokenEcma);

                        case "System.Net":
                        case "System.Windows":
                            return(PublicKeyTokenMicrosoft);

                        case "System.ServiceModel.Web":
                            return(PublicKeyTokenWinFX);
                        }
                    }
                    break;

                case PublicKeyTokenWinFX:
                    switch (name.Name)
                    {
                    case "System.ComponentModel.Composition":
                        return(PublicKeyTokenEcma);
                    }
                    if (name.Retargetable.GetValueOrDefault())
                    {
                        switch (name.Name)
                        {
                        case "Microsoft.CSharp":
                            return(PublicKeyTokenMicrosoft);

                        case "System.Numerics":
                        case "System.ServiceModel":
                        case "System.Xml.Serialization":
                        case "System.Xml.Linq":
                            return(PublicKeyTokenEcma);
                        }
                    }
                    break;
                }
            }
            return(null);
        }
예제 #17
0
파일: Fusion.cs 프로젝트: zgramana/ikvm
        internal static ParseAssemblyResult ParseAssemblyName(string fullName, out ParsedAssemblyName parsedName)
        {
            parsedName = new ParsedAssemblyName();
            int pos;
            ParseAssemblyResult res = ParseAssemblySimpleName(fullName, out pos, out parsedName.Name);

            if (res != ParseAssemblyResult.OK)
            {
                return(res);
            }
            else
            {
                const int ERROR_SXS_IDENTITIES_DIFFERENT = unchecked ((int)0x80073716);
                System.Collections.Generic.Dictionary <string, string> unknownAttributes = null;
                bool   hasProcessorArchitecture = false;
                bool   hasContentType           = false;
                bool   hasPublicKeyToken        = false;
                string publicKeyToken;
                while (pos != fullName.Length)
                {
                    string key   = null;
                    string value = null;
                    if (!TryParseAssemblyAttribute(fullName, ref pos, ref key, ref value))
                    {
                        return(ParseAssemblyResult.GenericError);
                    }
                    key = key.ToLowerInvariant();
                    switch (key)
                    {
                    case "version":
                        if (parsedName.Version != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        parsedName.Version = value;
                        break;

                    case "culture":
                        if (parsedName.Culture != null)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParseCulture(value, out parsedName.Culture))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "publickeytoken":
                        if (hasPublicKeyToken)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParsePublicKeyToken(value, out publicKeyToken))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        if (parsedName.HasPublicKey && parsedName.PublicKeyToken != publicKeyToken)
                        {
                            Marshal.ThrowExceptionForHR(ERROR_SXS_IDENTITIES_DIFFERENT);
                        }
                        parsedName.PublicKeyToken = publicKeyToken;
                        hasPublicKeyToken         = true;
                        break;

                    case "publickey":
                        if (parsedName.HasPublicKey)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        if (!ParsePublicKey(value, out publicKeyToken))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        if (hasPublicKeyToken && parsedName.PublicKeyToken != publicKeyToken)
                        {
                            Marshal.ThrowExceptionForHR(ERROR_SXS_IDENTITIES_DIFFERENT);
                        }
                        parsedName.PublicKeyToken = publicKeyToken;
                        parsedName.HasPublicKey   = true;
                        break;

                    case "retargetable":
                        if (parsedName.Retargetable.HasValue)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        switch (value.ToLowerInvariant())
                        {
                        case "yes":
                            parsedName.Retargetable = true;
                            break;

                        case "no":
                            parsedName.Retargetable = false;
                            break;

                        default:
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "processorarchitecture":
                        if (hasProcessorArchitecture)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        hasProcessorArchitecture = true;
                        switch (value.ToLowerInvariant())
                        {
                        case "none":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.None;
                            break;

                        case "msil":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.MSIL;
                            break;

                        case "x86":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.X86;
                            break;

                        case "ia64":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.IA64;
                            break;

                        case "amd64":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.Amd64;
                            break;

                        case "arm":
                            parsedName.ProcessorArchitecture = ProcessorArchitecture.Arm;
                            break;

                        default:
                            return(ParseAssemblyResult.GenericError);
                        }
                        break;

                    case "contenttype":
                        if (hasContentType)
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        hasContentType = true;
                        if (!value.Equals("windowsruntime", StringComparison.OrdinalIgnoreCase))
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        parsedName.WindowsRuntime = true;
                        break;

                    default:
                        if (key.Length == 0)
                        {
                            return(ParseAssemblyResult.GenericError);
                        }
                        if (unknownAttributes == null)
                        {
                            unknownAttributes = new System.Collections.Generic.Dictionary <string, string>();
                        }
                        if (unknownAttributes.ContainsKey(key))
                        {
                            return(ParseAssemblyResult.DuplicateKey);
                        }
                        unknownAttributes.Add(key, null);
                        break;
                    }
                }
                return(ParseAssemblyResult.OK);
            }
        }
예제 #18
0
		static bool IsFrameworkAssembly(ParsedAssemblyName name)
		{
			// Framework assemblies use different unification rules, so when
			// a new framework is released the new assemblies need to be added.
			switch (name.Name)
			{
				case "System":
				case "System.Core":
				case "System.Data":
				case "System.Data.DataSetExtensions":
				case "System.Data.Linq":
				case "System.Data.OracleClient":
				case "System.Data.Services":
				case "System.Data.Services.Client":
				case "System.IdentityModel":
				case "System.IdentityModel.Selectors":
				case "System.IO.Compression":
				case "System.Numerics":
				case "System.Reflection.Context":
				case "System.Runtime.Remoting":
				case "System.Runtime.Serialization":
				case "System.Runtime.WindowsRuntime":
				case "System.Runtime.WindowsRuntime.UI.Xaml":
				case "System.ServiceModel":
				case "System.Transactions":
				case "System.Windows.Forms":
				case "System.Xml":
				case "System.Xml.Linq":
				case "System.Xml.Serialization":
					return name.PublicKeyToken == PublicKeyTokenEcma;

				case "Microsoft.CSharp":
				case "Microsoft.VisualBasic":
				case "System.Collections":
				case "System.Collections.Concurrent":
				case "System.ComponentModel":
				case "System.ComponentModel.Annotations":
				case "System.ComponentModel.EventBasedAsync":
				case "System.Configuration":
				case "System.Configuration.Install":
				case "System.Design":
				case "System.Diagnostics.Contracts":
				case "System.Diagnostics.Debug":
				case "System.Diagnostics.Tools":
				case "System.Diagnostics.Tracing":
				case "System.DirectoryServices":
				case "System.Drawing":
				case "System.Drawing.Design":
				case "System.Dynamic.Runtime":
				case "System.EnterpriseServices":
				case "System.Globalization":
				case "System.IO":
				case "System.Linq":
				case "System.Linq.Expressions":
				case "System.Linq.Parallel":
				case "System.Linq.Queryable":
				case "System.Management":
				case "System.Messaging":
				case "System.Net":
				case "System.Net.Http":
				case "System.Net.Http.Rtc":
				case "System.Net.NetworkInformation":
				case "System.Net.Primitives":
				case "System.Net.Requests":
				case "System.ObjectModel":
				case "System.Reflection":
				case "System.Reflection.Extensions":
				case "System.Reflection.Primitives":
				case "System.Resources.ResourceManager":
				case "System.Runtime":
				case "System.Runtime.Extensions":
				case "System.Runtime.InteropServices":
				case "System.Runtime.InteropServices.WindowsRuntime":
				case "System.Runtime.Numerics":
				case "System.Runtime.Serialization.Formatters.Soap":
				case "System.Runtime.Serialization.Json":
				case "System.Runtime.Serialization.Primitives":
				case "System.Runtime.Serialization.Xml":
				case "System.Security":
				case "System.Security.Principal":
				case "System.ServiceModel.Duplex":
				case "System.ServiceModel.Http":
				case "System.ServiceModel.NetTcp":
				case "System.ServiceModel.Primitives":
				case "System.ServiceModel.Security":
				case "System.ServiceProcess":
				case "System.Text.Encoding":
				case "System.Text.Encoding.Extensions":
				case "System.Text.RegularExpressions":
				case "System.Threading":
				case "System.Threading.Tasks":
				case "System.Threading.Tasks.Parallel":
				case "System.Web":
				case "System.Web.Mobile":
				case "System.Web.Services":
				case "System.Windows":
				case "System.Xml.ReaderWriter":
				case "System.Xml.XDocument":
				case "System.Xml.XmlSerializer":
					return name.PublicKeyToken == PublicKeyTokenMicrosoft;

				case "System.ComponentModel.DataAnnotations":
				case "System.ServiceModel.Web":
				case "System.Web.Abstractions":
				case "System.Web.Extensions":
				case "System.Web.Extensions.Design":
				case "System.Web.DynamicData":
				case "System.Web.Routing":
					return name.PublicKeyToken == PublicKeyTokenWinFX;
			}

			return false;
		}
예제 #19
0
파일: Fusion.cs 프로젝트: zgramana/ikvm
 private static bool IsStrongNamed(ParsedAssemblyName name)
 {
     return(name.PublicKeyToken != null && name.PublicKeyToken != "null");
 }
예제 #20
0
		static string GetRemappedPublicKeyToken(ref ParsedAssemblyName name, Version version)
		{
			if (name.Retargetable.GetValueOrDefault() && version < SilverlightVersion)
			{
				return null;
			}
			if (name.PublicKeyToken == "ddd0da4d3e678217" && name.Name == "System.ComponentModel.DataAnnotations" && name.Retargetable.GetValueOrDefault())
			{
				return PublicKeyTokenWinFX;
			}
			if (SilverlightVersionMinimum <= version && version <= SilverlightVersionMaximum)
			{
				switch (name.PublicKeyToken)
				{
					case PublicKeyTokenSilverlight:
						switch (name.Name)
						{
							case "System":
							case "System.Core":
								return PublicKeyTokenEcma;
						}
						if (name.Retargetable.GetValueOrDefault())
						{
							switch (name.Name)
							{
								case "System.Runtime.Serialization":
								case "System.Xml":
									return PublicKeyTokenEcma;
								case "System.Net":
								case "System.Windows":
									return PublicKeyTokenMicrosoft;
								case "System.ServiceModel.Web":
									return PublicKeyTokenWinFX;
							}
						}
						break;
					case PublicKeyTokenWinFX:
						switch (name.Name)
						{
							case "System.ComponentModel.Composition":
								return PublicKeyTokenEcma;
						}
						if (name.Retargetable.GetValueOrDefault())
						{
							switch (name.Name)
							{
								case "Microsoft.CSharp":
									return PublicKeyTokenMicrosoft;
								case "System.Numerics":
								case "System.ServiceModel":
								case "System.Xml.Serialization":
								case "System.Xml.Linq":
									return PublicKeyTokenEcma;
							}
						}
						break;
				}
			}
			return null;
		}