private RequestMethod(string name, string mvcAttributeName, bool hasBody) { Name = name; HasBody = hasBody; TypeFilter = new IsOfAnyTypeFilter(MvcConstants.ToAspNetCoreFullName(mvcAttributeName)); ActionFilter = new ActionHasAttributeFilter(TypeFilter); }
public HomeController(IOptions <ClassTest> test, DataBase DB, IOptions <indentity> options, ActionFilter filter) { TTT = test.Value; db = DB; indentity = options.Value; context = filter; }
public void LoadFromConfiguration() { filter = (ActionFilter)NetReflector.Read(@"<actionFilter><actions><action>Created</action><action>Checked in</action></actions></actionFilter>"); Assert.AreEqual(2, filter.Actions.Length); Assert.AreEqual("Created", filter.Actions[0]); Assert.AreEqual("Checked in", filter.Actions[1]); }
public OfflineFilterPolicy() { Where.RespondsToHttpMethod("GET"); ModifyBy(chain => { chain.InsertFirst(ActionFilter.For <OfflineFilter>(x => x.Filter())); }); }
public FilterInformation() { Sort = string.Empty; Area = new AreaFilter(); Module = new ModuleFilter(); Action = new ActionFilter(); User = new UserFilter(); }
public void OnMessageReceived(IncomingMessage message) { this.logger.LogTrace("({0}:'{1}')", nameof(message), message.Message.Command); var version = message.Message.Payload as VersionPayload; if ((version != null) && (this.State == NetworkPeerState.HandShaked)) { if (message.NetworkPeer.Version >= ProtocolVersion.REJECT_VERSION) { message.NetworkPeer.SendMessageAsync(new RejectPayload() { Code = RejectCode.DUPLICATE }); } } if (version != null) { this.TimeOffset = this.dateTimeProvider.GetTimeOffset() - version.Timestamp; if ((version.Services & NetworkPeerServices.NODE_WITNESS) != 0) { this.SupportedTransactionOptions |= TransactionOptions.Witness; } } if (message.Message.Payload is HaveWitnessPayload) { this.SupportedTransactionOptions |= TransactionOptions.Witness; } var last = new ActionFilter((m, n) => { this.MessageProducer.PushMessage(m); NodeEventMessageIncoming messageReceived = MessageReceived; if (messageReceived != null) { foreach (NodeEventMessageIncoming handler in messageReceived.GetInvocationList().Cast <NodeEventMessageIncoming>()) { try { handler.DynamicInvoke(this, m); } catch (TargetInvocationException ex) { this.logger.LogError("Exception occurred: {0}", ex.InnerException.ToString()); } } } }); IEnumerator <INetworkPeerFilter> enumerator = this.Filters.Concat(new[] { last }).GetEnumerator(); this.FireFilters(enumerator, message); this.logger.LogTrace("(-)"); }
public void Configure(BehaviorGraph graph) { var settings = graph.Settings.Get <AuthenticationSettings>(); var filter = settings.PassThroughChains.As <IChainFilter>(); graph.Behaviors .Where(filter.Matches) .Each(x => x.Prepend(ActionFilter.For <PassThroughAuthenticationFilter>(a => a.Filter()))); }
public void Test() { ButtonPressAction quickSearchAction = new ButtonPressAction("/app/con[0]/ses[0]/wnd[0]/usr/tabsCTS/tabpTAB_MTD/ssubCSS:SAPLSEOD:0253/btnPUSH_FIND"); ProgramFilter programRuleset = new ProgramFilter("SAPLSEOD"); ActionFilter filteredAction = new ActionFilter(quickSearchAction, programRuleset); HotKeyTest test = new HotKeyTest(filteredAction); test.Run(); }
public void SetUp() { theGraph = BehaviorGraph.BuildFrom(r => { r.Actions.IncludeType <SomeEndpoint>(); r.Configure(g => { var chain = g.BehaviorFor <SomeEndpoint>(x => x.get_something(null)); chain.Prepend(ActionFilter.For <SomeEndpoint>(x => x.Filter(null))); }); }); }
public static void Main(string[] args) { ApplicationConfig config = new ApplicationConfig(); ButtonPressAction quickSearchAction = new ButtonPressAction("/usr/tabsCTS/tabpTAB_MTD/ssubCSS:SAPLSEOD:0253/btnPUSH_FIND"); ProgramFilter programRuleset = new ProgramFilter("SAPLSEOD"); ActionFilter filteredAction = new ActionFilter(quickSearchAction, programRuleset); config.RegisterOnHotKey(filteredAction, ModifierKeys.Control, Keys.D); config.Start(); }
private AvailableActionsResponse ActionFilterToResponse(ActionFilter actionFilter) { return(new AvailableActionsResponse { Items = (from action in Configuration.AddonConsoleActions where actionFilter.Check(action.Action) select new AvailableActionsResponse.AvailableActionsResponseItem { action = action.Action, description = action.Description }).ToArray() }); }
public void ResolveOnGainAbilities(IPlayer player) { var filter = new ActionFilter(); var actionCards = player.DiscardPile .Select(CardFactory.Create) .Where(filter.Apply).ToList(); player.DiscardPile.RemoveAll(x => filter.Apply(CardFactory.Create(x)) == true); //TODO: reveal player.Deck.AddRange(actionCards.Select(x => x.Name)); player.Deck.Shuffle(); }
public void OnActionExecuted(ActionExecutedContext filterContext) { var metadata = LogCall(OnActionExecutedGuid); var watch = new Stopwatch(); watch.Start(); ActionFilter.OnActionExecuted(filterContext); watch.Stop(); metadata.ExecutionTime = watch.Elapsed; }
protected void OnMessageReceived(IncomingMessage message) { message.IfPayloadIs <VersionPayload>(version => { if (State == NodeState.HandShaked) { if (message.Node.Version >= ProtocolVersion.REJECT_VERSION) { message.Node.SendMessageAsync(new RejectPayload() { Code = RejectCode.DUPLICATE }); } } }); //if(version != null) //{ // if((version.Services & NodeServices.NODE_WITNESS) != 0) // _SupportedTransactionOptions |= TransactionOptions.Witness; //} //var havewitness = message.Message.Payload as HaveWitnessPayload; //if(havewitness != null) // _SupportedTransactionOptions |= TransactionOptions.Witness; var last = new ActionFilter((m, n) => { MessageProducer.PushMessage(m); var messageReceived = MessageReceived; if (messageReceived != null) { foreach (var handler in messageReceived.GetInvocationList().Cast <NodeEventMessageIncoming>()) { try { handler.DynamicInvoke(this, m); } catch (TargetInvocationException ex) { TraceCorrelation.LogInside(() => NodeServerTrace.Error("Error while OnMessageReceived event raised", ex.InnerException), false); } } } }); var enumerator = Filters.Concat(new[] { last }).GetEnumerator(); FireFilters(enumerator, message); }
public void OnActionExecuting(ActionExecutingContext filterContext) { var metadata = LogCall(OnActionExecutingGuid); var watch = new Stopwatch(); watch.Start(); using (GlimpseTimer.Start("Executing: Action Filter", "Filter", ActionFilter.GetType().Name)) { ActionFilter.OnActionExecuting(filterContext); } watch.Stop(); metadata.ExecutionTime = watch.Elapsed; }
public void ShouldFilterSpecifiedModification() { Modification mod = new Modification(); mod.Type = "Created"; mod.UserName = "******"; ActionFilter aFilter = new ActionFilter(); UserFilter uFilter = new UserFilter(); aFilter.Actions = new string[] { "Created" }; uFilter.UserNames = new string[] { "bob" }; filter.Filters = new IModificationFilter[] { aFilter, uFilter }; Assert.IsTrue(filter.Accept(mod), "Modifcation not filtered"); }
public void ShouldNotFilterSpecifiedModWithOneFilterThatAccepts() { Modification mod = new Modification(); mod.Type = "Delete"; mod.UserName = "******"; ActionFilter aFilter = new ActionFilter(); UserFilter uFilter = new UserFilter(); aFilter.Actions = new string[] { "Created" }; uFilter.UserNames = new string[] { "bob" }; filter.Filters = new IModificationFilter[] { aFilter, uFilter }; Assert.IsFalse(filter.Accept(mod), "Modifcation was filtered"); }
// Methods public override bool ValidateUser(string text1, string text2) { bool flag = new bool(); object[] objArray = new object[] { text1, text2 }; AspectContext context = new AspectContext { Args = objArray, MethodName = "ValidateUser", ClassName = "UserMamager", Namespace = "AopTest" }; context.MethodInfo = MethodHelper.GetMethod(m_Agent, "ValidateUser"); context.Attributes = MethodHelper.GetCustomAttributes(m_Agent, "ValidateUser"); ActionFilter filter = new ActionFilter(); filter.OnExecuting(context); LogFilter filter2 = new LogFilter(); filter2.OnExecuting(context); if (new AuthenticatioFilter().OnAuthentication(context)) { try { flag = this.m_Agent.ValidateUser(text1, text2); } catch (Exception exception) { new ExceptionFilter().OnException(context, exception); } } object obj2 = flag; context.Result = obj2; filter.OnExecuted(context); filter2.OnExecuted(context); return(flag); }
public override void Alter(ActionCall call) { var filter = new ActionFilter(_filterType, _method); call.AddBefore(filter); }
protected void CreateFilter() { filter = new ActionFilter(); }
public void SetProxyFactory(IProxyFactory proxyFactory) { AlternateType <IActionFilter> alternationImplementation = new ActionFilter(proxyFactory); Assert.Equal(proxyFactory, alternationImplementation.ProxyFactory); }
public void ReturnTwoMethods(IProxyFactory proxyFactory) { AlternateType<IActionFilter> alternationImplementation = new ActionFilter(proxyFactory); Assert.Equal(2, alternationImplementation.AllMethods.Count()); }
public void ReturnTwoMethods(IProxyFactory proxyFactory) { AlternateType <IActionFilter> alternationImplementation = new ActionFilter(proxyFactory); Assert.Equal(2, alternationImplementation.AllMethods.Count()); }
public void SetProxyFactory(IProxyFactory proxyFactory) { AlternateType<IActionFilter> alternationImplementation = new ActionFilter(proxyFactory); Assert.Equal(proxyFactory, alternationImplementation.ProxyFactory); }
public void OnActionExecuting(ActionExecutingContext filterContext) { LogCall(OnActionExecutingGuid); ActionFilter.OnActionExecuting(filterContext); }
public override void Alter(ActionCallBase call) { var chain = call.ParentChain(); chain.Prepend(ActionFilter.For <PassThroughAuthenticationFilter>(a => a.Filter())); }
public void OnActionExecuted(ActionExecutedContext filterContext) { LogCall(OnActionExecutedGuid); ActionFilter.OnActionExecuted(filterContext); }