Inheritance: TileEffectComponent
Exemplo n.º 1
0
        protected override Object InterceptDeleteIntern(MethodInfo method, Object[] arguments, Attribute annotation,
                                                        Boolean?isAsyncBegin)
        {
            if (arguments == null || (arguments.Length != 1 && arguments.Length != 3))
            {
                throw new Exception("Arguments currently must be only 1 or 3: " + method.ToString());
            }
            ProceedWithMergeHook  proceedHook      = GetProceedHook(arguments);
            MergeFinishedCallback finishedCallback = GetFinishedCallback(arguments);
            RemoveAttribute       remove           = (RemoveAttribute)annotation;

            if (remove != null)
            {
                String idName     = remove.IdName;
                Type   entityType = remove.EntityType;
                if (idName != null && idName.Length > 0)
                {
                    if (entityType == null)
                    {
                        throw new Exception("Annotation invalid: " + remove + " on method " + method.ToString());
                    }
                    DeleteById(method, entityType, idName, arguments[0], proceedHook, finishedCallback);
                    return(null);
                }
            }
            Object argumentToDelete = arguments[0];

            MergeProcess.Process(null, argumentToDelete, proceedHook, finishedCallback);
            if (!typeof(void).Equals(method.ReturnType))
            {
                return(argumentToDelete);
            }
            return(null);
        }
Exemplo n.º 2
0
        public void ReplaceAttributeRegexTest()
        {
            HtmlDocument document = new HtmlDocument();

            document.LoadHtml(Resources.Metal);
            string input = document.QuerySelector(".band_comment").InnerText;

            RemoveAttribute remove = new RemoveAttribute("Read more", RemoverValueType.Regex);
            string          output = (string)remove.GetValue(input);

            string expected = "Played their final show of their very last tour entitled \"The End\" in Birmingham, England on February 4th, 2017. The band initially retired from large scale touring after the show, but later announced that they broke up.  Black Sabbath are generally considered both the first heavy metal and doom metal band. Originally they were called Polka Tulk (featuring a saxophonist and slide guitarist in ...";

            Assert.AreEqual(expected, output);
        }
        public void TestInboundStreamInterestRemoveAttribute()
        {
            var inboundStreamInterest =
                TestWorld.ActorFor <IInboundStreamInterest>(
                    () => new AttributesAgentActor(_localNode, Application, _outboundStream.Actor, Config, _interest));

            var addMessage = AddAttribute.From(_localNode, _set, _tracked);

            inboundStreamInterest.Actor.HandleInboundStreamMessage(AddressType.Op, RawMessageFor(_localNodeId, _localNode.Name, addMessage));
            var replaceMessage = RemoveAttribute.From(_localNode, _set, _tracked);

            inboundStreamInterest.Actor.HandleInboundStreamMessage(AddressType.Op, RawMessageFor(_localNodeId, _localNode.Name, replaceMessage));

            var channel1 = _channelProvider.ChannelFor(_localNodeId);

            Assert.Equal(2, Mock(channel1).Writes.Count);
            Assert.Equal(1, Application.InformAttributeAddedCheck.Get());
            Assert.Equal(1, Application.InformAttributeRemovedCheck.Get());
        }
Exemplo n.º 4
0
        internal void DistributeTo(
            AttributeSet set,
            TrackedAttribute tracked,
            ApplicationMessageType type,
            IEnumerable <Node> nodes)
        {
            switch (type)
            {
            case ApplicationMessageType.AddAttribute:
                var add            = AddAttribute.From(_node, set, tracked);
                var addConfirmable = _confirmables.UnconfirmedFor(add, nodes);
                _outbound.Application(ApplicationSays.From(_node.Id, _node.Name, add.ToPayload()), addConfirmable.UnconfirmedNodes);
                _application.InformAttributeAdded(set.Name !, tracked.Attribute?.Name);
                break;

            case ApplicationMessageType.RemoveAttribute:
                var remove            = RemoveAttribute.From(_node, set, tracked);
                var removeConfirmable = _confirmables.UnconfirmedFor(remove, nodes);
                _outbound.Application(ApplicationSays.From(_node.Id, _node.Name, remove.ToPayload()), removeConfirmable.UnconfirmedNodes);
                _application.InformAttributeRemoved(set.Name !, tracked.Attribute?.Name);
                break;

            case ApplicationMessageType.RemoveAttributeSet:
                var removeSet            = RemoveAttributeSet.From(_node, set);
                var removeSetConfirmable = _confirmables.UnconfirmedFor(removeSet, nodes);
                _outbound.Application(ApplicationSays.From(_node.Id, _node.Name, removeSet.ToPayload()), removeSetConfirmable.UnconfirmedNodes);
                _application.InformAttributeSetRemoved(set.Name);
                break;

            case ApplicationMessageType.ReplaceAttribute:
                var replace            = ReplaceAttribute.From(_node, set, tracked);
                var replaceConfirmable = _confirmables.UnconfirmedFor(replace, nodes);
                _outbound.Application(ApplicationSays.From(_node.Id, _node.Name, replace.ToPayload()), replaceConfirmable.UnconfirmedNodes);
                _application.InformAttributeReplaced(set.Name !, tracked.Attribute?.Name);
                break;

            default:
                throw new InvalidOperationException("Cannot distribute unknown ApplicationMessageType.");
            }
        }
 public ReflectedRemoveDefinition(RemoveAttribute attr, MethodBase method)
 {
     this.info = new CommonReflectionInfo(this, attr ?? RemoveAttribute.Default, method);
 }
 public ReflectedRemoveDefinition(RemoveAttribute attr, MethodBase method)
 {
     this.info = new CommonReflectionInfo(this, attr ?? RemoveAttribute.Default, method);
 }