protected virtual void WritePathItems(string path, bool namesOnly) { using (PscxProviderContext <AssemblyCacheProvider> .Enter(this)) { if (namesOnly) { // note: // dynamic parameters are NOT used here // due to the "one to many" relationship. // write out keys in cache AssemblyNameCache cache = GetCache(path); foreach (string cachedPath in cache.Paths) { WriteItemObject(cachedPath, cachedPath, false); } } else { // write out values in cache ICollection <AssemblyName> assemblyNames = GetAssemblyNames(path); foreach (AssemblyName assemblyName in assemblyNames) { if (MatchesDynamicParameterFilters(assemblyName)) { WriteItemObject(assemblyName, assemblyName.Name, false); } } } } }
private static void InitializeCache(ref AssemblyNameCache cache, AssemblyCacheType type) { Utils.DoubleCheckInit <AssemblyNameCache>(ref cache, _syncRoot, delegate { return(new AssemblyNameCache(type)); }); }
private ICollection <AssemblyName> GetAssemblyNames(string path) { AssemblyNameCache cache = GetCache(path); if (path == BACKSLASH) { return(cache.AssemblyNames); } // return zero-length array if no entry in the cache return(cache[path] ?? new AssemblyName[0]); }