예제 #1
0
 public static void RegisterServerHandlerConnector(ConnectorBase con)
 {
     ServerHandlerConnectors.Add(con);
 }
예제 #2
0
 public static void RegisterConnector(ConnectorBase con)
 {
     Connectors.Add(con);
 }
예제 #3
0
 public static void RegisterServerHandlerConnector(ConnectorBase con)
 {
     ServerHandlerConnectors.Add(con);
 }
예제 #4
0
        public ServerHandler(string url, IRegistryCore registry, ConnectorBase conn)
            : base("POST", url)
        {
            m_registry = registry;
            if (m_methods == null)
            {
                m_methods = new Dictionary<string, List<MethodImplementation>>();
                List<string> alreadyRunPlugins = new List<string>();
                List<ConnectorBase> connectors = conn == null
                                                     ? ConnectorRegistry.Connectors
                                                     : new List<ConnectorBase>() {conn};
                foreach (ConnectorBase plugin in connectors)
                {
                    if (alreadyRunPlugins.Contains(plugin.PluginName))
                        continue;
                    alreadyRunPlugins.Add(plugin.PluginName);
                    foreach (MethodInfo method in plugin.GetType().GetMethods())
                    {
                        CanBeReflected reflection =
                            (CanBeReflected) Attribute.GetCustomAttribute(method, typeof (CanBeReflected));
                        if (reflection != null)
                        {
                            string methodName = reflection.RenamedMethod == "" ? method.Name : reflection.RenamedMethod;
                            List<MethodImplementation> methods = new List<MethodImplementation>();
                            MethodImplementation imp = new MethodImplementation()
                                                           {
                                                               Method = method,
                                                               Reference = plugin,
                                                               Attribute = reflection
                                                           };
                            if (!m_methods.TryGetValue(methodName, out methods))
                                m_methods.Add(methodName, (methods = new List<MethodImplementation>()));

                            methods.Add(imp);
                        }
                    }
                }
            }
        }
예제 #5
0
 public static void RegisterConnector(ConnectorBase con)
 {
     Connectors.Add(con);
 }