public void Update(System.Reflection.AssemblyName aname) { Name = aname.Name; Version = aname.Version.ToString(); if (aname.CultureInfo != null) { if (aname.CultureInfo.LCID == System.Globalization.CultureInfo.InvariantCulture.LCID) { Culture = "neutral"; } else { Culture = aname.CultureInfo.Name; } } string fn = aname.ToString(); string key = "publickeytoken="; int i = fn.ToLower().IndexOf(key) + key.Length; int j = fn.IndexOf(',', i); if (j == -1) { j = fn.Length; } PublicKeyToken = fn.Substring(i, j - i); }
public override Type BindToType(string assemblyName, string typeName) { var an = new System.Reflection.AssemblyName(assemblyName); an.Version = null; return(System.Reflection.Assembly.Load(an.ToString()).GetType(typeName)); }
public override string ToString() { string str = name.ToString(); if (culture != null) { str = str.Replace("Culture=neutral", "Culture=" + culture); } return(str); }
public static string Format(this AssemblyIdentity assemblyIdentity) { var name = new System.Reflection.AssemblyName(); name.Name = assemblyIdentity.Name.Value; #if !COREFX name.CultureInfo = new CultureInfo(assemblyIdentity.Culture); #endif name.Version = assemblyIdentity.Version; name.SetPublicKeyToken(assemblyIdentity.PublicKeyToken.ToArray()); #if !COREFX name.CodeBase = assemblyIdentity.Location; #endif return name.ToString(); }
private static string GetAssemblyIdentityWithoutCultureAndVersion(string assemblyIdentity) { var assembly = new System.Reflection.AssemblyName(assemblyIdentity) { Version = null }; #if FEATURE_ASSEMBLYNAME_CULTUREINFO assembly.CultureInfo = null; #else assembly.CultureName = null; #endif return(assembly.ToString()); }
public static string Format(this AssemblyIdentity assemblyIdentity) { var name = new System.Reflection.AssemblyName(); name.Name = assemblyIdentity.Name.Value; #if !COREFX name.CultureInfo = new CultureInfo(assemblyIdentity.Culture); #endif name.Version = assemblyIdentity.Version; name.SetPublicKeyToken(assemblyIdentity.PublicKeyToken.ToArray()); #if !COREFX name.CodeBase = assemblyIdentity.Location; #endif return(name.ToString()); }
private static string GetAssemblyIdentityWithoutCultureAndVersion(string assemblyIdentity) { var assemblyName = new System.Reflection.AssemblyName(assemblyIdentity) { Version = null }; #if CORECLR assemblyName.CultureName = null; #else assemblyName.CultureInfo = null; #endif return(assemblyName.ToString()); }
public static string Format(this AssemblyIdentity assemblyIdentity) { var name = new System.Reflection.AssemblyName(); var cultureInfo = new CultureInfo(assemblyIdentity.Culture); name.Name = assemblyIdentity.Name.Value; #if NETSTANDARD1_3 || NETSTANDARD1_6 name.CultureName = cultureInfo.Name; #else name.CultureInfo = cultureInfo; #endif name.Version = assemblyIdentity.Version; name.SetPublicKeyToken(assemblyIdentity.PublicKeyToken.ToArray()); #if !NETSTANDARD1_3 && !NETSTANDARD1_6 name.CodeBase = assemblyIdentity.Location; #endif return(name.ToString()); }
public static string Format(this AssemblyIdentity assemblyIdentity) { var name = new System.Reflection.AssemblyName(); var cultureInfo = new CultureInfo(assemblyIdentity.Culture); name.Name = assemblyIdentity.Name.Value; #if FEATURE_ASSEMBLYNAME_CULTUREINFO name.CultureInfo = cultureInfo; #else name.CultureName = cultureInfo.Name; #endif name.Version = assemblyIdentity.Version; name.SetPublicKeyToken(assemblyIdentity.PublicKeyToken.ToArray()); #if FEATURE_ASSEMBLYNAME_CODEBASE name.CodeBase = assemblyIdentity.Location; #endif return(name.ToString()); }
public override string ToString() { return(name.ToString()); }