internal static extern void FreeAssemblyName(ref MonoAssemblyName name, bool freeStruct);
internal static extern void FreeAssemblyName(ref MonoAssemblyName name);
internal static extern void FreeAssemblyName (ref MonoAssemblyName name);
internal static extern void FreeAssemblyName (ref MonoAssemblyName name, bool freeStruct);
static extern bool ParseAssemblyName (IntPtr name, out MonoAssemblyName aname, out bool is_version_definited, out bool is_token_defined);
internal unsafe void FillName (MonoAssemblyName *native, string codeBase, bool addVersion, bool addPublickey, bool defaultToken) { this.name = RuntimeMarshal.PtrToUtf8String (native->name); this.major = native->major; this.minor = native->minor; this.build = native->build; this.revision = native->revision; this.flags = (AssemblyNameFlags)native->flags; this.hashalg = (AssemblyHashAlgorithm)native->hash_alg; this.versioncompat = AssemblyVersionCompatibility.SameMachine; this.processor_architecture = (ProcessorArchitecture)native->arch; if (addVersion) this.version = new Version (this.major, this.minor, this.build, this.revision); this.codebase = codeBase; if (native->culture != IntPtr.Zero) this.cultureinfo = CultureInfo.CreateCulture ( RuntimeMarshal.PtrToUtf8String (native->culture), false); if (native->public_key != IntPtr.Zero) { this.publicKey = RuntimeMarshal.DecodeBlobArray (native->public_key); this.flags |= AssemblyNameFlags.PublicKey; } else if (addPublickey) { this.publicKey = EmptyArray<byte>.Value; this.flags |= AssemblyNameFlags.PublicKey; } // MonoAssemblyName keeps the public key token as an hexadecimal string if (native->public_key_token [0] != 0) { byte[] keyToken = new byte [8]; for (int i = 0, j = 0; i < 8; ++i) { keyToken [i] = (byte)(RuntimeMarshal.AsciHexDigitValue (native->public_key_token [j++]) << 4); keyToken [i] |= (byte)RuntimeMarshal.AsciHexDigitValue (native->public_key_token [j++]); } this.keyToken = keyToken; } else if (defaultToken) { this.keyToken = EmptyArray<byte>.Value; } }