internal static void RefreshAssemblies()

in Scripts/Runtime/ResponseManager/MatchIntentRegistry.cs [53:79]


        internal static void RefreshAssemblies()
        {
            // TODO: We could potentially build this list at compile time and cache it
            // Work on a local dictionary to avoid thread complications
            var dictionary = new DictionaryList<string, RegisteredMatchIntent>();
            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (Type t in assembly.GetTypes())
                {
                    foreach (var method in t.GetMethods())
                    {
                        foreach (var attribute in method.GetCustomAttributes(typeof(MatchIntent)))
                        {
                            var mi = (MatchIntent) attribute;
                            dictionary[mi.Intent].Add(new RegisteredMatchIntent()
                            {
                                type = t,
                                method = method,
                                matchIntent = mi
                            });
                        }
                    }
                }
            }

            registeredMethods = dictionary;
        }