示例#1
0
 public override AssemblyName[] GetReferencedAssemblies()
 {
     using (var nativeNames = new Mono.SafeGPtrArrayHandle(InternalGetReferencedAssemblies(this))) {
         var numAssemblies = nativeNames.Length;
         try {
             AssemblyName [] result       = new AssemblyName[numAssemblies];
             const bool      addVersion   = true;
             const bool      addPublicKey = false;
             const bool      defaultToken = true;
             const bool      assemblyRef  = true;
             for (int i = 0; i < numAssemblies; i++)
             {
                 AssemblyName name = new AssemblyName();
                 unsafe {
                     Mono.MonoAssemblyName *nativeName = (Mono.MonoAssemblyName *)nativeNames[i];
                     name.FillName(nativeName, null, addVersion, addPublicKey, defaultToken, assemblyRef);
                     result[i] = name;
                 }
             }
             return(result);
         } finally {
             for (int i = 0; i < numAssemblies; i++)
             {
                 unsafe {
                     Mono.MonoAssemblyName *nativeName = (Mono.MonoAssemblyName *)nativeNames[i];
                     Mono.RuntimeMarshal.FreeAssemblyName(ref *nativeName, true);
                 }
             }
         }
     }
 }
示例#2
0
        internal static AssemblyName Create(Assembly assembly, bool fillCodebase)
        {
            AssemblyName aname = new AssemblyName();

            unsafe {
                MonoAssemblyName *native = GetNativeName(assembly.MonoAssembly);
                aname.FillName(native, fillCodebase ? assembly.CodeBase : null, true, true, true);
            }
            return(aname);
        }
示例#3
0
        internal static AssemblyName Create(IntPtr monoAssembly, string codeBase)
        {
            AssemblyName aname = new AssemblyName();

            unsafe {
                MonoAssemblyName *native = GetNativeName(monoAssembly);
                aname.FillName(native, codeBase, true, true, true);
            }
            return(aname);
        }
示例#4
0
        static AssemblyName GetFileInformationCore(string assemblyFile)
        {
            unsafe {
                Assembly.InternalGetAssemblyName(Path.GetFullPath(assemblyFile), out var nativeName, out var codebase);

                var aname = new AssemblyName();
                try {
                    aname.FillName(&nativeName, codebase, true, false, true);
                    return(aname);
                } finally {
                    RuntimeMarshal.FreeAssemblyName(ref nativeName, false);
                }
            }
        }
示例#5
0
        public static AssemblyName GetAssemblyName(string assemblyFile)
        {
            if (assemblyFile == null)
            {
                throw new ArgumentNullException("assemblyFile");
            }

            AssemblyName aname = new AssemblyName();

            unsafe {
                Mono.MonoAssemblyName nativeName;
                string codebase;
                Assembly.InternalGetAssemblyName(Path.GetFullPath(assemblyFile), out nativeName, out codebase);
                try {
                    aname.FillName(&nativeName, codebase, true, false, true, false);
                } finally {
                    RuntimeMarshal.FreeAssemblyName(ref nativeName, false);
                }
            }
            return(aname);
        }
示例#6
0
		internal static AssemblyName Create (Assembly assembly, bool fillCodebase)
		{
			AssemblyName aname = new AssemblyName ();
			unsafe {
				MonoAssemblyName *native = GetNativeName (assembly._mono_assembly);
				aname.FillName (native, fillCodebase ? assembly.CodeBase : null, true, true, true);
			}
			return aname;
		}
示例#7
0
		public static AssemblyName GetAssemblyName (string assemblyFile) 
		{
			if (assemblyFile == null)
				throw new ArgumentNullException ("assemblyFile");

			AssemblyName aname = new AssemblyName ();
			unsafe {
				Mono.MonoAssemblyName nativeName;
				string codebase;
				Assembly.InternalGetAssemblyName (Path.GetFullPath (assemblyFile), out nativeName, out codebase);
				try {
					aname.FillName (&nativeName, codebase, true, false, true, false);
				} finally {
					RuntimeMarshal.FreeAssemblyName (ref nativeName, false);
				}
			}
			return aname;
		}