本文整理汇总了C#中AssemblyNameFlags类的典型用法代码示例。如果您正苦于以下问题:C# AssemblyNameFlags类的具体用法?C# AssemblyNameFlags怎么用?C# AssemblyNameFlags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssemblyNameFlags类属于命名空间,在下文中一共展示了AssemblyNameFlags类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateAssemblyName
private static AssemblyName CreateAssemblyName(MetadataName name, MetadataName culture, Version version, AssemblyNameFlags flags, byte[] publicKeyOrToken) {
var result = new AssemblyName();
result.Name = name.ToString();
if (!culture.IsEmpty) {
result.CultureInfo = new CultureInfo(culture.ToString());
}
result.Version = version;
result.Flags = flags;
if (publicKeyOrToken.Length != 0) {
if ((result.Flags & AssemblyNameFlags.PublicKey) != 0) {
result.SetPublicKey(publicKeyOrToken);
} else {
result.SetPublicKeyToken(publicKeyOrToken);
}
}
return result;
}
示例2: AssemblyFlagsAttribute
public AssemblyFlagsAttribute(uint flags)
{
m_flags = (AssemblyNameFlags)flags;
}
示例3: AssemblyName
public AssemblyName()
{
_HashAlgorithm = AssemblyHashAlgorithm.None;
_VersionCompatibility = AssemblyVersionCompatibility.SameMachine;
_Flags = AssemblyNameFlags.None;
}
示例4: AssemblyName
public AssemblyName()
{
_Flags = AssemblyNameFlags.None;
}
示例5: AssemblyName
public AssemblyName(string assemblyName)
{
if (assemblyName == null)
{
throw new ArgumentNullException("assemblyName");
}
if (assemblyName == "")
{
throw new ArgumentException();
}
ParsedAssemblyName parsed;
switch (Fusion.ParseAssemblyName(assemblyName, out parsed))
{
case ParseAssemblyResult.GenericError:
case ParseAssemblyResult.DuplicateKey:
throw new FileLoadException();
}
if (!ParseVersion(parsed.Version, parsed.Retargetable.HasValue, out version))
{
throw new FileLoadException();
}
name = parsed.Name;
if (parsed.Culture != null)
{
if (parsed.Culture.Equals("neutral", StringComparison.OrdinalIgnoreCase))
{
culture = "";
}
else if (parsed.Culture == "")
{
throw new FileLoadException();
}
else
{
culture = new CultureInfo(parsed.Culture).Name;
}
}
if (parsed.PublicKeyToken != null)
{
if (parsed.PublicKeyToken.Equals("null", StringComparison.OrdinalIgnoreCase))
{
publicKeyToken = Empty<byte>.Array;
}
else if (parsed.PublicKeyToken.Length != 16)
{
throw new FileLoadException();
}
else
{
publicKeyToken = ParseKey(parsed.PublicKeyToken);
}
}
if (parsed.Retargetable.HasValue)
{
if (parsed.Culture == null || parsed.PublicKeyToken == null || version == null)
{
throw new FileLoadException();
}
if (parsed.Retargetable.Value)
{
flags |= AssemblyNameFlags.Retargetable;
}
}
ProcessorArchitecture = parsed.ProcessorArchitecture;
if (parsed.WindowsRuntime)
{
ContentType = AssemblyContentType.WindowsRuntime;
}
}
示例6: GetAssemblyNameFromTypelib
internal static AssemblyName GetAssemblyNameFromTypelib(object typeLib, string asmFileName, byte[] publicKey, StrongNameKeyPair keyPair, Version asmVersion, AssemblyNameFlags asmNameFlags)
{
string strName = null;
string strDocString = null;
int dwHelpContext = 0;
string strHelpFile = null;
ITypeLib typeLibrary = (ITypeLib) typeLib;
typeLibrary.GetDocumentation(-1, out strName, out strDocString, out dwHelpContext, out strHelpFile);
if (asmFileName == null)
{
asmFileName = strName;
}
else
{
string fileName = Path.GetFileName(asmFileName);
string extension = Path.GetExtension(asmFileName);
if (!".dll".Equals(extension, StringComparison.OrdinalIgnoreCase))
{
throw new ArgumentException(Environment.GetResourceString("Arg_InvalidFileExtension"));
}
asmFileName = fileName.Substring(0, fileName.Length - ".dll".Length);
}
if (asmVersion == null)
{
int num2;
int num3;
Marshal.GetTypeLibVersion(typeLibrary, out num2, out num3);
asmVersion = new Version(num2, num3, 0, 0);
}
AssemblyName name = new AssemblyName();
name.Init(asmFileName, publicKey, null, asmVersion, null, AssemblyHashAlgorithm.None, AssemblyVersionCompatibility.SameMachine, null, asmNameFlags, keyPair);
return name;
}
示例7: ExtractAssemblyNameFlags
internal static AssemblyNameFlags ExtractAssemblyNameFlags(AssemblyNameFlags combinedFlags)
{
return combinedFlags & unchecked((AssemblyNameFlags)0xFFFFF10F);
}
示例8: CombineAssemblyNameFlags
internal static AssemblyNameFlags CombineAssemblyNameFlags(AssemblyNameFlags flags, AssemblyContentType contentType, ProcessorArchitecture processorArchitecture)
{
return (AssemblyNameFlags)(((int)flags) | (((int)contentType) << 9) | ((int)processorArchitecture << 4));
}
示例9: ExtractAssemblyContentType
//
// These helpers convert between the combined flags+contentType+processorArchitecture value and the separated parts.
//
// Since these are only for trusted callers, they do NOT check for out of bound bits.
//
internal static AssemblyContentType ExtractAssemblyContentType(AssemblyNameFlags flags)
{
return (AssemblyContentType)((((int)flags) >> 9) & 0x7);
}
示例10: ExtractProcessorArchitecture
internal static ProcessorArchitecture ExtractProcessorArchitecture(AssemblyNameFlags flags)
{
return (ProcessorArchitecture)((((int)flags) >> 4) & 0x7);
}
示例11: GetAssemblyNameFromTypelib
[System.Security.SecurityCritical] // auto-generated
internal static AssemblyName GetAssemblyNameFromTypelib(Object typeLib, String asmFileName, byte[] publicKey, StrongNameKeyPair keyPair, Version asmVersion, AssemblyNameFlags asmNameFlags)
{
// Extract the name of the typelib.
String strTypeLibName = null;
String strDocString = null;
int dwHelpContext = 0;
String strHelpFile = null;
ITypeLib pTLB = (ITypeLib)typeLib;
pTLB.GetDocumentation(-1, out strTypeLibName, out strDocString, out dwHelpContext, out strHelpFile);
// Retrieve the name to use for the assembly.
if (asmFileName == null)
{
asmFileName = strTypeLibName;
}
else
{
Contract.Assert((asmFileName != null) && (asmFileName.Length > 0), "The assembly file name cannot be an empty string!");
String strFileNameNoPath = Path.GetFileName(asmFileName);
String strExtension = Path.GetExtension(asmFileName);
// Validate that the extension is valid.
bool bExtensionValid = ".dll".Equals(strExtension, StringComparison.OrdinalIgnoreCase);
// If the extension is not valid then tell the user and quit.
if (!bExtensionValid)
throw new ArgumentException(Environment.GetResourceString("Arg_InvalidFileExtension"));
// The assembly cannot contain the path nor the extension.
asmFileName = strFileNameNoPath.Substring(0, strFileNameNoPath.Length - ".dll".Length);
}
// If the version information was not specified, then retrieve it from the typelib.
if (asmVersion == null)
{
int major;
int minor;
Marshal.GetTypeLibVersion(pTLB, out major, out minor);
asmVersion = new Version(major, minor, 0, 0);
}
// Create the assembly name for the imported typelib's assembly.
AssemblyName AsmName = new AssemblyName();
AsmName.Init(
asmFileName,
publicKey,
null,
asmVersion,
null,
AssemblyHashAlgorithm.None,
AssemblyVersionCompatibility.SameMachine,
null,
asmNameFlags,
keyPair);
return AsmName;
}
示例12: AssemblyName
internal AssemblyName (SerializationInfo si, StreamingContext sc)
{
name = si.GetString ("_Name");
codebase = si.GetString ("_CodeBase");
version = (Version)si.GetValue ("_Version", typeof (Version));
publicKey = (byte[])si.GetValue ("_PublicKey", typeof (byte[]));
keyToken = (byte[])si.GetValue ("_PublicKeyToken", typeof (byte[]));
hashalg = (AssemblyHashAlgorithm)si.GetValue ("_HashAlgorithm", typeof (AssemblyHashAlgorithm));
keypair = (StrongNameKeyPair)si.GetValue ("_StrongNameKeyPair", typeof (StrongNameKeyPair));
versioncompat = (AssemblyVersionCompatibility)si.GetValue ("_VersionCompatibility", typeof (AssemblyVersionCompatibility));
flags = (AssemblyNameFlags)si.GetValue ("_Flags", typeof (AssemblyNameFlags));
int lcid = si.GetInt32 ("_CultureInfo");
if (lcid != -1) cultureinfo = new CultureInfo (lcid);
}
示例13: AssemblyFlagsAttribute
public AssemblyFlagsAttribute (AssemblyNameFlags assemblyFlags)
{
this.flags = (uint)assemblyFlags;
}
示例14: __SetAssemblyFlags
public void __SetAssemblyFlags(AssemblyNameFlags flags)
{
this.__AssemblyFlags = flags;
}
示例15: SetPublicKey
public void SetPublicKey(byte[] publicKey)
{
_PublicKey = publicKey;
if (publicKey == null)
_Flags &= ~AssemblyNameFlags.PublicKey;
else
_Flags |= AssemblyNameFlags.PublicKey;
}