Exemplo n.º 1
0
 /// <exclude/>
 public static bool ContainsAssembly(string assemblyFullName)
 {
     if ((assemblyFullName == null) || (assemblyFullName.Length == 0))
     {
         throw new ArgumentNullException("assemblyFullName");
     }
     SystemOp.IAssemblyCache cache1 = null;
     if ((SystemOp.CreateAssemblyCache(out cache1, 0) == 0) && (cache1.QueryAssemblyInfo(0, assemblyFullName, IntPtr.Zero) == 0))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 /// <exclude/>
 public static bool AddAssembly(string assemblyFileName)
 {
     if ((assemblyFileName == null) || (assemblyFileName.Length == 0))
     {
         throw new ArgumentNullException("assemblyFileName");
     }
     if (!File.Exists(assemblyFileName))
     {
         throw new ArgumentException("assemblyFileName");
     }
     SystemOp.IAssemblyCache cache1 = null;
     if ((SystemOp.CreateAssemblyCache(out cache1, 0) == 0) && (cache1.InstallAssembly(0, assemblyFileName, IntPtr.Zero) == 0))
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
        /// <exclude/>
        public static bool RemoveAssembly(string assemblyFullName)
        {
            uint num2;

            if ((assemblyFullName == null) || (assemblyFullName.Length == 0))
            {
                throw new ArgumentNullException("assemblyFullName");
            }
            SystemOp.IAssemblyCache cache1 = null;
            if (SystemOp.CreateAssemblyCache(out cache1, 0) != 0)
            {
                return(false);
            }
            if (cache1.UninstallAssembly(0, assemblyFullName, IntPtr.Zero, out num2) != 0)
            {
                return(!GacUtil.ContainsAssembly(assemblyFullName));
            }
            return(true);
        }