/// <summary> /// Loads any custom tag handlers found in the dll referenced in the argument /// </summary> /// <param name="pathToDLL">the path to the dll containing the custom tag handling code</param> static public void loadCustomTagHandlers(string pathToDLL) { // return; string hostSystemResolveToExistingPath = HostSystem.ResolveToExistingPath(pathToDLL); if (hostSystemResolveToExistingPath == null) { throw new FileNotFoundException(pathToDLL); } Assembly tagDLL = Assembly.LoadFrom(hostSystemResolveToExistingPath); var tagDLLTypes = tagDLL.GetTypes(); for (int i = 0; i < tagDLLTypes.Length; i++) { Type type = tagDLLTypes[i]; try { var typeCustomAttributes = type.GetCustomAttributes(false); if (typeCustomAttributes.Length == 0 && typeof(AIMLTagHandler).IsAssignableFrom(type) && !type.IsAbstract && !type.IsInterface) { try { AddTagHandler(type); } catch (Exception e) { AltBot.writeException(e); } continue; } for (int j = 0; j < typeCustomAttributes.Length; j++) { if (typeCustomAttributes[j] is CustomTagAttribute) { // We've found a custom tag handling class // so store the assembly and store it away in the Dictionary<,> as a TagHandler class for // later usage try { AddTagHandler(type); } catch (Exception e) { AltBot.writeException(e); } } } } catch (Exception ee) { AltBot.writeException(ee); } } }