Esempio n. 1
0
 public PageInfo(string id, T container, Control page, IModuleToken token, SimpleModule module)
 {
     this.Id        = id;
     this.Page      = page;
     this.Token     = token;
     Module         = module;
     this.Container = container;
 }
Esempio n. 2
0
        public override void configure(JacksonJsonDataFormat dataFormat)
        {
            ObjectMapper objectMapper = dataFormat.ObjectMapper;
            SimpleModule module       = new SimpleModule();

            module.addDeserializer(typeof(XmlSerializable), new XmlSerializableJsonDeserializer());
            module.addSerializer(typeof(XmlSerializable), new XmlSerializableJsonSerializer());
            objectMapper.registerModule(module);
        }
Esempio n. 3
0
		public SimpleTU(SimpleModule simpleModule)
		{
			this.dialogManager = new DialogManager();

			this.simpleModule = simpleModule;
			this.simpleModule.NotifyEvent += SimpleModule_NotifyEvent;
			this.simpleModule.SubscriptionRemovedEvent += SimpleModule_SubscriptionRemovedEvent;

			this.notifyProducer = new ProducedRequest(this);
		}
Esempio n. 4
0
        public SimpleTU(SimpleModule simpleModule)
        {
            this.dialogManager = new DialogManager();

            this.simpleModule              = simpleModule;
            this.simpleModule.NotifyEvent += SimpleModule_NotifyEvent;
            this.simpleModule.SubscriptionRemovedEvent += SimpleModule_SubscriptionRemovedEvent;

            this.notifyProducer = new ProducedRequest(this);
        }
Esempio n. 5
0
    public void Init(SimpleModule chip)
    {
        foreach (Transform t in transform)
        {
            t.GetComponent <ModuleSlot>().enabled = false;
            Destroy(t.gameObject);
        }

        _grid.constraintCount = chip.Size;
        _grid.cellSize        = Mathf.RoundToInt(_size / chip.Size) * Vector2.one;
        for (int i = 0; i < chip.Size; i++)
        {
            for (int j = 0; j < chip.Size; j++)
            {
                GameObject slotGo = Instantiate(ElementSlot, Vector3.zero, Quaternion.identity, transform);
                slotGo.transform.localScale    = Vector3.one;
                slotGo.transform.localPosition = Vector3.zero;
                slotGo.GetComponent <ModuleSlot>().Init(DefaultResources.GetElementByEnum((LogicElement.LogicElementType)chip.Elements[i, j]), new Vector2(i, j));
            }
        }
    }
        private static WebServer StartWebServerOnAvailablePort(out Uri serverUri, Action <IHttpContext> handler)
        {
            var module = new SimpleModule(handler);

            for (int port = 10000; ; port++)
            {
                var options = new WebServerOptions()
                              .WithUrlPrefix($"http://*:{port}")
                              .WithMode(HttpListenerMode.EmbedIO);
                var server = new WebServer(options).WithModule(module);
                try
                {
                    _ = server.RunAsync();
                }
                catch (HttpListenerException)
                {
                    continue;
                }
                serverUri = new Uri(string.Format("http://localhost:{0}", port));
                return(server);
            }
        }
Esempio n. 7
0
 public void SetSubmodule(int id, SimpleModule submodule)
 {
     _submodules[id] = submodule;
     OnSubmoduleSeted(submodule, id);
 }
Esempio n. 8
0
		public Initializer(EventHandler<EventArgs> configChangedHandler)
		{
			var configuration = SipServerConfigurationSection.GetSection();

			var adUsers = (configuration.IsActiveDirectoryEnabled == false) ? null : new AdUsers(configuration.ActiveDirectoryGroup);

			Func<Userz> CreateUserz = () =>
			{
				var result = new Userz(configuration.CustomUsersPath);

				result.Add(new CsvUsers(configuration.UsersCsvFilePathName));
				if (adUsers != null)
					result.Add(adUsers);

				result.LoadCustomUsers();

				return result;
			};


			var serversManager = new ServersManager<Connection>(new ServersManagerConfig());
			var transportLayer = new TransportLayer(serversManager, configuration.WebSocketResponseFrame);
			var authorization = new SipAuthorizationManager();
			var transactionLayer = new TransactionLayer(authorization);
			var userz = CreateUserz();
			var locationService = new LocationService();
			var mras = new Mras.Mras1();
			var trunkManager = new TrunkManager();
			var accounts = new Accountx(configuration.AccountConfigFilePathName);
			var msPresTu = new MsPresTU(accounts, userz, locationService);
			var wcfService = new WCFService(configuration, msPresTu.EnhancedPresence, trunkManager, accounts, userz);
			var httpAuthorization = new HttpAuthorizationManager();
			var httpServer = new HttpServer(httpAuthorization, configuration.AdminUri);
			//var httpServerAgentRegistrar = new Func<IHttpServerAgent, IHttpServer>((agent) => { return httpServer.Register(agent); });
			var restapi = new RestapiService(accounts, userz) { AdministratorPassword = configuration.AdministratorPassword, };
			var httpFileServer = new HttpFileServer(configuration.WwwPath, string.Empty);
			var xcapServer = new XcapServer();
			var configurationMonitor = new ConfigurationMonitor();
			var simpleModule = new SimpleModule(EqualityComparer<string>.Default);
            var proxyServerTU = new ProxyServerTU(locationService, trunkManager, accounts);

			GetResults = (
				out TransportLayer transportLayer1,
				out TransactionLayer transactionLayer1,
				out LocationService locationService1,
				out WCFService wcfService1,
				out ConfigurationMonitor configurationMonitor1,
				out TrunkManager trunkManager1,
				out SipAuthorizationManager authorization1,
				out Userz userz1,
				out AdUsers adUsers1,
				out Mras.Mras1 mras1,
				out HttpFileServer httpFileServer1,
				out Accountx accounts1,
				out RestapiService restapi1,
                out ProxyServerTU proxyServerTU1
				) =>
			{
				transportLayer1 = transportLayer;
				transactionLayer1 = transactionLayer;
				locationService1 = locationService;
				wcfService1 = wcfService;
				configurationMonitor1 = configurationMonitor;
				trunkManager1 = trunkManager;
				authorization1 = authorization;
				userz1 = userz;
				adUsers1 = adUsers;
				mras1 = mras;
				httpFileServer1 = httpFileServer;
				accounts1 = accounts;
				restapi1 = restapi;
                proxyServerTU1 = proxyServerTU;
			};


			Action InitializeTracer = () =>
			{
				Tracer.Initialize(serversManager.Logger);
                Tracer.Configure(configuration.TracingPath, configuration.IsTracingEnabled);
			};


			Action InitializeConfigurationMonitor = () =>
			{
				configurationMonitor.Changed += configChangedHandler;
				configurationMonitor.StartMonitoring(configuration);
			};

			Action InitializeHttpModules = () =>
			{
				httpServer.SendAsync = transportLayer.SendAsyncHttp;
				transportLayer.IncomingHttpRequest = httpServer.ProcessIncomingRequest;

				httpServer.Register(restapi, 0, true);
				httpServer.Register(xcapServer, 0, true);
				httpServer.Register(new HttpFileServer(configuration.WwwAdminPath, configuration.AdminUri), 254, true);
				httpServer.Register(httpFileServer, 255, true);

				xcapServer.AddHandler(new ResourceListsHandler(accounts, userz));
				xcapServer.AddHandler(new PidfManipulationHandler(simpleModule));
			};

			Action InitializeWcfService = () =>
			{
				wcfService.Start();
			};


            Action InitializeProxyServerTU = () =>
            {
                proxyServerTU.IsOfficeSIPFiletransferEnabled = configuration.IsOfficeSIPFiletransferEnabled;
            };


            Action InitializeTransactionLayer = () =>
			{
                InitializeProxyServerTU();

				transportLayer.IncomingMessage += transactionLayer.IncomingMessage;
				transportLayer.SendErrorSip += transactionLayer.TransportError;
				transactionLayer.SendAsync = transportLayer.SendAsyncSip;
				transactionLayer.IsLocalAddress = transportLayer.IsLocalAddress;

				serversManager.EndConnection += (s, c) => { locationService.RemoveBindingsWhenConnectionEnd(c.Id); };
				transactionLayer.RegisterTransactionUser(new RegistrarTU(locationService, accounts));

				transactionLayer.RegisterTransactionUser(msPresTu);

				transactionLayer.RegisterTransactionUser(new SimpleTU(simpleModule));
				transactionLayer.RegisterTransactionUser(new OptionsTU());
				transactionLayer.RegisterTransactionUser(new MessageSummaryTU());

				transactionLayer.RegisterTransactionUser(new MrasTU(mras));

				transactionLayer.RegisterTransactionUser(new DirectorySearchTU(accounts, new ServiceSoap.ServiceSoap1(), userz));

                transactionLayer.RegisterTransactionUser(proxyServerTU);

				transactionLayer.RegisterTransactionUser(new TrunkTU(trunkManager));
				transactionLayer.RegisterTransactionUser(new ErrorTU());
			};


			Action InitializeAuthorization = () =>
			{
				authorization.IsEnabled = configuration.IsAuthorizationEnabled;

				if (configuration.IsActiveDirectoryEnabled)
				{
					var kerberosAuth = new SipMicrosoftAuthentication(SipAuthSchemes.Kerberos, accounts, userz);
					var ntlmAuth = new SipMicrosoftAuthentication(SipAuthSchemes.Ntlm, accounts, userz);

					authorization.RegisterAgent(kerberosAuth, SipAuthSchemes.Kerberos);
					authorization.RegisterAgent(ntlmAuth, SipAuthSchemes.Ntlm);
				}

				var digestAuth = new SipDigestAuthentication(accounts, userz, configuration.IsAuthIntEnabled);
				authorization.RegisterAgent(digestAuth, SipAuthSchemes.Digest);



				httpAuthorization.IsEnabled = configuration.IsAuthorizationEnabled;
				httpAuthorization.RegisterAgent(new HttpDigestAuthentication(accounts, userz, false), HttpAuthSchemes.Digest);
			};


			Action InitializeServersManager = () =>
			{
				serversManager.FakeAddressAction = (ServerEndPoint localEndpoint) =>
				{
					foreach (var portForwarding in configuration.PortForwardings)
					{
						if (localEndpoint.Equals(portForwarding.Protocol, portForwarding.LocalEndpoint))
							return portForwarding.ExternalEndpoint;
					}

					return null;
				};

				Action<ServerProtocol, int> bind = (protocol, port) =>
				{
					if (port > 0)
					{
						var error = serversManager.Bind(new ProtocolPort()
						{
							Protocol = protocol,
							Port = port,
						});

						if (error != SocketError.Success)
							Tracer.WriteError("Can't open " + protocol + " port " + port + ".\r\n" + error.ToString());
					}
				};

				if (configuration.UdpPort > 0)
					bind(ServerProtocol.Udp, configuration.UdpPort);
				if (configuration.TcpPort > 0)
					bind(ServerProtocol.Tcp, configuration.TcpPort);
				if (configuration.TcpPort2 > 0)
					bind(ServerProtocol.Tcp, configuration.TcpPort2);
			};

			ConfigureMras(mras, configuration);
			InitializeConfigurationMonitor();
			InitializeTracer();
			InitializeTransactionLayer();
			InitializeAuthorization();
			InitializeWcfService();
			InitializeHttpModules();
			InitializeServersManager();
		}
 public PidfManipulationHandler(SimpleModule simpleModule)
 {
     this.simpleModule = simpleModule;
 }
Esempio n. 10
0
 public PageInfo(PageInfo <T> info, T container, Control page, IModuleToken token, SimpleModule module) :
     this(info.Id, container, page, token, module)
 {
     info.Next     = this;
     this.Previous = info;
 }
Esempio n. 11
0
 public virtual Control Attach([NotNull] SimpleModule module)
 {
     return(Attach(module, module.GetToken()));
 }
Esempio n. 12
0
        public Initializer(EventHandler <EventArgs> configChangedHandler)
        {
            var configuration = SipServerConfigurationSection.GetSection();

            var adUsers = (configuration.IsActiveDirectoryEnabled == false) ? null : new AdUsers(configuration.ActiveDirectoryGroup);

            Func <Userz> CreateUserz = () =>
            {
                var result = new Userz(configuration.CustomUsersPath);

                result.Add(new CsvUsers(configuration.UsersCsvFilePathName));
                if (adUsers != null)
                {
                    result.Add(adUsers);
                }

                result.LoadCustomUsers();

                return(result);
            };


            var serversManager    = new ServersManager <Connection>(new ServersManagerConfig());
            var transportLayer    = new TransportLayer(serversManager, configuration.WebSocketResponseFrame);
            var authorization     = new SipAuthorizationManager();
            var transactionLayer  = new TransactionLayer(authorization);
            var userz             = CreateUserz();
            var locationService   = new LocationService();
            var mras              = new Mras.Mras1();
            var trunkManager      = new TrunkManager();
            var accounts          = new Accountx(configuration.AccountConfigFilePathName);
            var msPresTu          = new MsPresTU(accounts, userz, locationService);
            var wcfService        = new WCFService(configuration, msPresTu.EnhancedPresence, trunkManager, accounts, userz);
            var httpAuthorization = new HttpAuthorizationManager();
            var httpServer        = new HttpServer(httpAuthorization, configuration.AdminUri);
            //var httpServerAgentRegistrar = new Func<IHttpServerAgent, IHttpServer>((agent) => { return httpServer.Register(agent); });
            var restapi = new RestapiService(accounts, userz)
            {
                AdministratorPassword = configuration.AdministratorPassword,
            };
            var httpFileServer       = new HttpFileServer(configuration.WwwPath, string.Empty);
            var xcapServer           = new XcapServer();
            var configurationMonitor = new ConfigurationMonitor();
            var simpleModule         = new SimpleModule(EqualityComparer <string> .Default);
            var proxyServerTU        = new ProxyServerTU(locationService, trunkManager, accounts);

            GetResults = (
                out TransportLayer transportLayer1,
                out TransactionLayer transactionLayer1,
                out LocationService locationService1,
                out WCFService wcfService1,
                out ConfigurationMonitor configurationMonitor1,
                out TrunkManager trunkManager1,
                out SipAuthorizationManager authorization1,
                out Userz userz1,
                out AdUsers adUsers1,
                out Mras.Mras1 mras1,
                out HttpFileServer httpFileServer1,
                out Accountx accounts1,
                out RestapiService restapi1,
                out ProxyServerTU proxyServerTU1
                ) =>
            {
                transportLayer1       = transportLayer;
                transactionLayer1     = transactionLayer;
                locationService1      = locationService;
                wcfService1           = wcfService;
                configurationMonitor1 = configurationMonitor;
                trunkManager1         = trunkManager;
                authorization1        = authorization;
                userz1          = userz;
                adUsers1        = adUsers;
                mras1           = mras;
                httpFileServer1 = httpFileServer;
                accounts1       = accounts;
                restapi1        = restapi;
                proxyServerTU1  = proxyServerTU;
            };


            Action InitializeTracer = () =>
            {
                Tracer.Initialize(serversManager.Logger);
                Tracer.Configure(configuration.TracingPath, configuration.IsTracingEnabled);
            };


            Action InitializeConfigurationMonitor = () =>
            {
                configurationMonitor.Changed += configChangedHandler;
                configurationMonitor.StartMonitoring(configuration);
            };

            Action InitializeHttpModules = () =>
            {
                httpServer.SendAsync = transportLayer.SendAsyncHttp;
                transportLayer.IncomingHttpRequest = httpServer.ProcessIncomingRequest;

                httpServer.Register(restapi, 0, true);
                httpServer.Register(xcapServer, 0, true);
                httpServer.Register(new HttpFileServer(configuration.WwwAdminPath, configuration.AdminUri), 254, true);
                httpServer.Register(httpFileServer, 255, true);

                xcapServer.AddHandler(new ResourceListsHandler(accounts, userz));
                xcapServer.AddHandler(new PidfManipulationHandler(simpleModule));
            };

            Action InitializeWcfService = () =>
            {
                wcfService.Start();
            };


            Action InitializeProxyServerTU = () =>
            {
                proxyServerTU.IsOfficeSIPFiletransferEnabled = configuration.IsOfficeSIPFiletransferEnabled;
            };


            Action InitializeTransactionLayer = () =>
            {
                InitializeProxyServerTU();

                transportLayer.IncomingMessage += transactionLayer.IncomingMessage;
                transportLayer.SendErrorSip    += transactionLayer.TransportError;
                transactionLayer.SendAsync      = transportLayer.SendAsyncSip;
                transactionLayer.IsLocalAddress = transportLayer.IsLocalAddress;

                serversManager.EndConnection += (s, c) => { locationService.RemoveBindingsWhenConnectionEnd(c.Id); };
                transactionLayer.RegisterTransactionUser(new RegistrarTU(locationService, accounts));

                transactionLayer.RegisterTransactionUser(msPresTu);

                transactionLayer.RegisterTransactionUser(new SimpleTU(simpleModule));
                transactionLayer.RegisterTransactionUser(new OptionsTU());
                transactionLayer.RegisterTransactionUser(new MessageSummaryTU());

                transactionLayer.RegisterTransactionUser(new MrasTU(mras));

                transactionLayer.RegisterTransactionUser(new DirectorySearchTU(accounts, new ServiceSoap.ServiceSoap1(), userz));

                transactionLayer.RegisterTransactionUser(proxyServerTU);

                transactionLayer.RegisterTransactionUser(new TrunkTU(trunkManager));
                transactionLayer.RegisterTransactionUser(new ErrorTU());
            };


            Action InitializeAuthorization = () =>
            {
                authorization.IsEnabled = configuration.IsAuthorizationEnabled;

                if (configuration.IsActiveDirectoryEnabled)
                {
                    var kerberosAuth = new SipMicrosoftAuthentication(SipAuthSchemes.Kerberos, accounts, userz);
                    var ntlmAuth     = new SipMicrosoftAuthentication(SipAuthSchemes.Ntlm, accounts, userz);

                    authorization.RegisterAgent(kerberosAuth, SipAuthSchemes.Kerberos);
                    authorization.RegisterAgent(ntlmAuth, SipAuthSchemes.Ntlm);
                }

                var digestAuth = new SipDigestAuthentication(accounts, userz, configuration.IsAuthIntEnabled);
                authorization.RegisterAgent(digestAuth, SipAuthSchemes.Digest);



                httpAuthorization.IsEnabled = configuration.IsAuthorizationEnabled;
                httpAuthorization.RegisterAgent(new HttpDigestAuthentication(accounts, userz, false), HttpAuthSchemes.Digest);
            };


            Action InitializeServersManager = () =>
            {
                serversManager.FakeAddressAction = (ServerEndPoint localEndpoint) =>
                {
                    foreach (var portForwarding in configuration.PortForwardings)
                    {
                        if (localEndpoint.Equals(portForwarding.Protocol, portForwarding.LocalEndpoint))
                        {
                            return(portForwarding.ExternalEndpoint);
                        }
                    }

                    return(null);
                };

                Action <ServerProtocol, int> bind = (protocol, port) =>
                {
                    if (port > 0)
                    {
                        var error = serversManager.Bind(new ProtocolPort()
                        {
                            Protocol = protocol,
                            Port     = port,
                        });

                        if (error != SocketError.Success)
                        {
                            Tracer.WriteError("Can't open " + protocol + " port " + port + ".\r\n" + error.ToString());
                        }
                    }
                };

                if (configuration.UdpPort > 0)
                {
                    bind(ServerProtocol.Udp, configuration.UdpPort);
                }
                if (configuration.TcpPort > 0)
                {
                    bind(ServerProtocol.Tcp, configuration.TcpPort);
                }
                if (configuration.TcpPort2 > 0)
                {
                    bind(ServerProtocol.Tcp, configuration.TcpPort2);
                }
            };

            ConfigureMras(mras, configuration);
            InitializeConfigurationMonitor();
            InitializeTracer();
            InitializeTransactionLayer();
            InitializeAuthorization();
            InitializeWcfService();
            InitializeHttpModules();
            InitializeServersManager();
        }
		public PidfManipulationHandler(SimpleModule simpleModule)
		{
			this.simpleModule = simpleModule;
		}
Esempio n. 14
0
 public PageControllerToken([NotNull] IModuleToken contentToken, SimpleModule content = null) : base("")
 {
     ContentToken = contentToken;
     Content      = content;
 }
Esempio n. 15
0
        public void Can_create_types()
        {
            var module = new SimpleModule();

            Assert.IsNotNull(module.GetInstance <IService>());
        }
        /// <summary>
        /// 获取所有模块
        /// </summary>
        /// <param name="controllers"></param>
        /// <returns></returns>
        private static List <SimpleModule> GetAllModules(List <Type> controllers)
        {
            var modules = new List <SimpleModule>();

            foreach (var ctrl in controllers)
            {
                var pubattr1  = ctrl.GetCustomAttributes(typeof(PublicAttribute), false);
                var pubattr12 = ctrl.GetCustomAttributes(typeof(AllowAnonymousAttribute), false);
                var rightattr = ctrl.GetCustomAttributes(typeof(AllRightsAttribute), false);
                var debugattr = ctrl.GetCustomAttributes(typeof(DebugOnlyAttribute), false);
                var areaattr  = ctrl.GetCustomAttributes(typeof(AreaAttribute), false);
                var model     = new SimpleModule
                {
                    ClassName = ctrl.Name.Replace("Controller", string.Empty)
                };
                if (ctrl.Namespace == "KnifeZ.Virgo.Mvc")
                {
                    continue;
                }
                if (areaattr.Length == 0 && model.ClassName == "Home")
                {
                    continue;
                }
                if (areaattr.Length == 0 && model.ClassName == "Account")
                {
                    continue;
                }
                if (pubattr1.Length > 0 || pubattr12.Length > 0 || rightattr.Length > 0 || debugattr.Length > 0)
                {
                    model.IgnorePrivillege = true;
                }
                if (typeof(BaseApiController).IsAssignableFrom(ctrl))
                {
                    model.IsApi = true;
                }
                model.NameSpace = ctrl.Namespace;
                //获取controller上标记的ActionDescription属性的值
                var attrs = ctrl.GetCustomAttributes(typeof(ActionDescriptionAttribute), false);
                if (attrs.Length > 0)
                {
                    var ada     = attrs[0] as ActionDescriptionAttribute;
                    var nameKey = ada.GetDescription(ctrl);
                    model.ModuleName = nameKey;
                    ada.SetLoccalizer(ctrl);
                    model.ActionDes = ada;
                }
                else
                {
                    model.ModuleName = model.ClassName;
                }
                //获取该controller下所有的方法
                var methods = ctrl.GetMethods(BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.Instance);
                //过滤掉/Login/Login方法和特殊方法
                if (model.ClassName.ToLower() == "login")
                {
                    methods = methods.Where(x => x.IsSpecialName == false && x.Name.ToLower() != "login").ToArray();
                }
                else
                {
                    methods = methods.Where(x => x.IsSpecialName == false).ToArray();
                }
                model.Actions = new List <SimpleAction>();
                //循环所有方法
                foreach (var method in methods)
                {
                    var pubattr2   = method.GetCustomAttributes(typeof(PublicAttribute), false);
                    var pubattr22  = method.GetCustomAttributes(typeof(AllowAnonymousAttribute), false);
                    var arattr2    = method.GetCustomAttributes(typeof(AllRightsAttribute), false);
                    var debugattr2 = method.GetCustomAttributes(typeof(DebugOnlyAttribute), false);
                    var postAttr   = method.GetCustomAttributes(typeof(HttpPostAttribute), false);
                    //如果不是post的方法,则添加到controller的action列表里
                    if (postAttr.Length == 0)
                    {
                        var action = new SimpleAction
                        {
                            Module     = model,
                            MethodName = method.Name
                        };
                        if (pubattr2.Length > 0 || pubattr22.Length > 0 || arattr2.Length > 0 || debugattr2.Length > 0)
                        {
                            action.IgnorePrivillege = true;
                        }

                        var attrs2 = method.GetCustomAttributes(typeof(ActionDescriptionAttribute), false);
                        if (attrs2.Length > 0)
                        {
                            var ada = attrs2[0] as ActionDescriptionAttribute;
                            ada.SetLoccalizer(ctrl);
                            action.ActionDes = ada;
                        }
                        else
                        {
                            action.ActionName = action.MethodName;
                        }
                        var pars = method.GetParameters();
                        if (pars != null && pars.Length > 0)
                        {
                            action.ParasToRunTest = new List <string>();
                            foreach (var par in pars)
                            {
                                action.ParasToRunTest.Add(par.Name);
                            }
                        }
                        model.Actions.Add(action);
                    }
                }
                //再次循环所有方法
                foreach (var method in methods)
                {
                    var pubattr2   = method.GetCustomAttributes(typeof(PublicAttribute), false);
                    var pubattr22  = method.GetCustomAttributes(typeof(AllowAnonymousAttribute), false);
                    var arattr2    = method.GetCustomAttributes(typeof(AllRightsAttribute), false);
                    var debugattr2 = method.GetCustomAttributes(typeof(DebugOnlyAttribute), false);

                    var postAttr = method.GetCustomAttributes(typeof(HttpPostAttribute), false);
                    //找到post的方法且没有同名的非post的方法,添加到controller的action列表里
                    if (postAttr.Length > 0 && model.Actions.Where(x => x.MethodName.ToLower() == method.Name.ToLower()).FirstOrDefault() == null)
                    {
                        if (method.Name.ToLower().StartsWith("dobatch"))
                        {
                            if (model.Actions.Where(x => "do" + x.MethodName.ToLower() == method.Name.ToLower()).FirstOrDefault() != null)
                            {
                                continue;
                            }
                        }
                        var action = new SimpleAction
                        {
                            Module     = model,
                            MethodName = method.Name
                        };
                        if (pubattr2.Length > 0 || pubattr22.Length > 0 || arattr2.Length > 0 || debugattr2.Length > 0)
                        {
                            action.IgnorePrivillege = true;
                        }
                        var attrs2 = method.GetCustomAttributes(typeof(ActionDescriptionAttribute), false);
                        if (attrs2.Length > 0)
                        {
                            var ada = attrs2[0] as ActionDescriptionAttribute;
                            ada.SetLoccalizer(ctrl);
                            action.ActionDes = ada;
                        }
                        else
                        {
                            action.ActionName = action.MethodName;
                        }
                        var pars = method.GetParameters();
                        if (pars != null && pars.Length > 0)
                        {
                            action.ParasToRunTest = new List <string>();
                            foreach (var par in pars)
                            {
                                action.ParasToRunTest.Add(par.Name);
                            }
                        }
                        model.Actions.Add(action);
                    }
                }
                if (model.Actions != null && model.Actions.Count > 0)
                {
                    if (areaattr.Length > 0)
                    {
                        string areaName  = (areaattr[0] as AreaAttribute).RouteValue;
                        var    existArea = modules.Where(x => x.Area?.AreaName == areaName).Select(x => x.Area).FirstOrDefault();
                        if (existArea == null)
                        {
                            model.Area = new SimpleArea
                            {
                                AreaName = (areaattr[0] as AreaAttribute).RouteValue,
                                Prefix   = (areaattr[0] as AreaAttribute).RouteValue,
                            };
                        }
                        else
                        {
                            model.Area = existArea;
                        }
                    }
                    modules.Add(model);
                }
            }

            return(modules);
        }