public static bool RebuildGACAssemblyCache(bool forceRebuild)
{
if (_gacNameCache.Length != 0 && !forceRebuild) return true;
IAssemblyEnum iterator = null;
try { iterator = GAC.CreateGACEnum(); }
catch (Exception e)
{
TraceWriter.WriteTrace("Could not obtain GAC assembly enumerator, " + e.Message);
iterator = null;
}
if (iterator == null) return false;
IAssemblyName currentName = null;
List<GACAssemblyName> gacNames = new List<GACAssemblyName>();
while (GAC.GetNextAssembly(iterator, out currentName) == 0)
{
if (currentName == null) continue;
string displayName = GAC.GetDisplayName(currentName, ASM_DISPLAY_FLAGS.PUBLIC_KEY_TOKEN | ASM_DISPLAY_FLAGS.VERSION | ASM_DISPLAY_FLAGS.CULTURE);
gacNames.Add(new GACAssemblyName(displayName));
}
_gacNameCache = gacNames.ToArray();
return true;
}
#endregion