Beispiel #1
0
        public void UnregisterLinks(Plugin plugin)
        {
            foreach (FieldInfo info in linkFields[plugin])
            {
                PipeLink link = info.GetCustomAttribute <PipeLink>();
                if (link != null)
                {
                    PluginManager.Manager.Logger.Debug("PIPE_MANAGER", $"Unlinking {info.Name} of {plugin.Details.id} from {link.Pipe} of {link.Plugin}");
                    info.SetValue(plugin, null);
                }
            }
            linkFields.Remove(plugin);

            if (linkFieldReferences.ContainsKey(plugin))
            {
                PluginManager.Manager.Logger.Debug("PIPE_MANAGER", $"Unlinking all field references to {plugin.Details.id}");

                foreach (KeyValuePair <Plugin, List <FieldInfo> > infos in linkFieldReferences[plugin])
                {
                    foreach (FieldInfo info in infos.Value)
                    {
                        PipeLink link = info.GetCustomAttribute <PipeLink>();
                        if (link != null)
                        {
                            info.SetValue(infos.Key, null);
                        }
                    }
                }
            }
            linkFieldReferences.Remove(plugin);
        }
Beispiel #2
0
        public List <string> GetLinkDependencies(Plugin plugin)
        {
            Type          type         = plugin.GetType();
            List <string> dependencies = new List <string>();

            foreach (MemberInfo info in type.GetMembers(AllMembers))
            {
                PipeLink link = info.GetCustomAttribute <PipeLink>();
                if (!dependencies.Contains(link.Plugin))
                {
                    dependencies.Add(link.Plugin);
                }
            }

            return(dependencies);
        }
Beispiel #3
0
        public void RegisterLinks(Plugin plugin)
        {
            Type type = plugin.GetType();

            List <FieldInfo> fields = new List <FieldInfo>();

            foreach (FieldInfo info in type.GetFields(AllMembers))
            {
                PipeLink link = info.GetCustomAttribute <PipeLink>();
                if (link != null)
                {
                    PluginManager.Manager.Logger.Debug("PIPE_MANAGER", $"Linking {info.Name} of {plugin.Details.id} to {link.Pipe} of {link.Plugin}.");
                    SetPipeLink(plugin, info, link.Plugin, link.Pipe);
                }
            }
            linkFields.Add(plugin, fields);
        }