private AssemblyNameCache GetCache(string path)
        {
            AssemblyCacheType type = GetCacheType(path);

            switch (type)
            {
            case AssemblyCacheType.Gac:
                if (IsRefreshSet)
                {
                    AssemblyNameCache.Gac.Refresh();
                }
                return(AssemblyNameCache.Gac);

            case AssemblyCacheType.Download:
                if (IsRefreshSet)
                {
                    AssemblyNameCache.Download.Refresh();
                }
                return(AssemblyNameCache.Download);

            case AssemblyCacheType.NGen:
                if (IsRefreshSet)
                {
                    AssemblyNameCache.NGen.Refresh();
                }
                return(AssemblyNameCache.NGen);
            }

            return(null);
        }
Esempio n. 2
0
 private static void InitializeCache(ref AssemblyNameCache cache, AssemblyCacheType type)
 {
     Utils.DoubleCheckInit <AssemblyNameCache>(ref cache, _syncRoot, delegate
     {
         return(new AssemblyNameCache(type));
     });
 }
Esempio n. 3
0
        private static string GetCachePath(AssemblyCacheType cache)
        {
            int           bufferSize = NativeMethods.MAX_PATH;
            StringBuilder buffer     = new StringBuilder(bufferSize);

            NativeMethods.GetCachePath(cache, buffer, ref bufferSize);

            return(buffer.ToString());
        }
        public static string GetCachePath(AssemblyCacheType type)
        {
            int pcchPath = 0;

            UnmanagedApi.FusionNative.GetCachePath((uint)type, null, ref pcchPath);

            var cachePath = new StringBuilder(pcchPath);

            UnmanagedApi.FusionNative.GetCachePath((uint)type, cachePath, ref pcchPath);

            return(cachePath.ToString());
        }
Esempio n. 5
0
        public static IEnumerable <AssemblyName> GetAssemblies(string partialName, AssemblyCacheType cacheType)
        {
            IAssemblyEnum enumerator;
            IAssemblyName assemblyName = null;

            if (partialName != null)
            {
                assemblyName = AssemblyCache.CreateAssemblyName(partialName);
            }

            NativeMethods.CreateAssemblyEnum(out enumerator, IntPtr.Zero, assemblyName, cacheType, IntPtr.Zero);

            return(new AssemblyCacheSearcher(enumerator));
        }
Esempio n. 6
0
        private static string GetCachePath(AssemblyCacheType cache)
        {
            int bufferSize = NativeMethods.MAX_PATH;
            StringBuilder buffer = new StringBuilder(bufferSize);

            NativeMethods.GetCachePath(cache, buffer, ref bufferSize);

            return buffer.ToString();
        }
Esempio n. 7
0
        public static IEnumerable<AssemblyName> GetAssemblies(string partialName, AssemblyCacheType cacheType)
        {
            IAssemblyEnum enumerator;
            IAssemblyName assemblyName = null;

            if (partialName != null)
            {
                assemblyName = AssemblyCache.CreateAssemblyName(partialName);
            }

            NativeMethods.CreateAssemblyEnum(out enumerator, IntPtr.Zero, assemblyName, cacheType, IntPtr.Zero);

            return new AssemblyCacheSearcher(enumerator);
        }
Esempio n. 8
0
 public static IEnumerable<AssemblyName> GetAssemblies(AssemblyCacheType cacheType)
 {
     return GetAssemblies(null, cacheType);
 }
Esempio n. 9
0
        private AssemblyNameCache(AssemblyCacheType cacheType)
        {
            _type = cacheType;

            Refresh();
        }
Esempio n. 10
0
 public static extern void GetCachePath(AssemblyCacheType dwCacheFlags, StringBuilder pwzCachePath, ref int pcchPath);
Esempio n. 11
0
 public static extern void CreateAssemblyEnum(out IAssemblyEnum pEnum, IntPtr pUnkReserved, IAssemblyName pName,
     AssemblyCacheType dwFlags, IntPtr pvReserved);
Esempio n. 12
0
 public static IEnumerable <AssemblyName> GetAssemblies(AssemblyCacheType cacheType)
 {
     return(GetAssemblies(null, cacheType));
 }
Esempio n. 13
0
 public static extern void GetCachePath(AssemblyCacheType dwCacheFlags, StringBuilder pwzCachePath, ref int pcchPath);
Esempio n. 14
0
 public static extern void CreateAssemblyEnum(out IAssemblyEnum pEnum, IntPtr pUnkReserved, IAssemblyName pName,
                                              AssemblyCacheType dwFlags, IntPtr pvReserved);