示例#1
0
 void IEventsVisitor.Visit(PropertyChange propertyChange)
 {
     CreateElement(SC.Elt_PropertyChange, propertyChange.Trigger,
                   new XAttribute(SC.Attr_ObjectId, propertyChange.ObjectId),
                   new XAttribute(SC.Attr_PropertyName, propertyChange.PropertyName),
                   MakeNullableAttr(SC.Attr_Value, propertyChange.Value),
                   MakeNullableAttr(SC.Attr_OldValue, propertyChange.OldValue),
                   new XAttribute(SC.Attr_ValueType, propertyChange.ValueType.ToString().ToLower()),
                   MakeTagsAttr(propertyChange)
                   );
 }
示例#2
0
        public IEnumerable <Event> Deserialize(XElement root)
        {
            foreach (var elt in root.Elements())
            {
                Event ret = null;
                switch (elt.Name.LocalName)
                {
                case SC.Elt_ObjectCreation:
                    ret = new ObjectCreation(
                        MakeTrigger(elt),
                        objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)),
                        objectInfoPool.Intern(new ObjectTypeInfo(
                                                  Attr(elt, SC.Attr_ObjectType),
                                                  Attr(elt, SC.Attr_CommentPropertyName),
                                                  Attr(elt, SC.Attr_PrimaryPropertyName),
                                                  (Attr(elt, SC.Attr_IsTimeless) ?? "0") == "1"
                                                  )),
                        isWeak: (Attr(elt, SC.Attr_IsWeak) ?? "0") == "1",
                        displayName: Attr(elt, SC.Attr_DisplayNamePropertyName)
                        );
                    break;

                case SC.Elt_ObjectDeletion:
                    ret = new ObjectDeletion(MakeTrigger(elt), objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)), null);
                    break;

                case SC.Elt_PropertyChange:
                    ret = new PropertyChange(MakeTrigger(elt),
                                             objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)),
                                             null,
                                             propertyName: propNamesPool.Intern(Attr(elt, SC.Attr_PropertyName)),
                                             value: Attr(elt, SC.Attr_Value),
                                             oldValue: Attr(elt, SC.Attr_OldValue),
                                             valueType: ToValueType(Attr(elt, SC.Attr_ValueType)));
                    break;

                case SC.Elt_ParentChildRelationChange:
                    ret = new ParentChildRelationChange(
                        MakeTrigger(elt),
                        objectIdsPool.Intern(Attr(elt, SC.Attr_ObjectId)),
                        null,
                        newParentObjectId: objectIdsPool.Intern(Attr(elt, SC.Attr_NewParentObjectId)),
                        isWeak: (Attr(elt, SC.Attr_IsWeak) ?? "0") == "1");
                    break;
                }
                if (ret != null)
                {
                    ret.Tags = tagsPool.Intern(
                        new HashSet <string>((Attr(elt, SC.Attr_Tags) ?? "").Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)));
                    yield return(ret);
                }
            }
        }
示例#3
0
 void IEventsVisitor.Visit(PropertyChange propertyChange)
 {
     Output.AppendFormat("PropertyChange: {0}.{1} {2} -> {3}",
                         propertyChange.ObjectId, propertyChange.PropertyName, propertyChange.OldValue ?? "", propertyChange.Value);
 }