Exemple #1
0
 public void AddRange(SnapshotMemberCollection value)
 {
     for (int i = 0; (i < value.Count); i = (i + 1))
     {
         this.Add(value[i]);
     }
 }
Exemple #2
0
        /// <summary>
        /// 用 usageObject 中属性的值,更新 sourceObject
        /// </summary>
        /// <param name="sourceObject"></param>
        /// <param name="usageObject"></param>
        public static void Update(object sourceObject, object usageObject)
        {
            if (sourceObject == null || usageObject == null)
            {
                return;
            }

            SnapshotMemberCollection members = new SnapshotMemberCollection();

            foreach (ObjectCompareResult result in ObjectCompare.Compare(sourceObject, usageObject))
            {
                members.Add(result.MemberName, result.SourceValue, result.CompareValue);
            }

            foreach (SnapshotMember member in members)
            {
                member.SetMember(sourceObject, SnapshotMember.EnumMemberValue.NewValue);
            }
        }
        /// <summary>
        /// 撤销对传入的 obj 对象的所有更改
        /// 还原之后会把快照给清除掉
        /// </summary>
        public void Revert()
        {
            if (_mirrorObject == null || _object == null)
            {
                return;
            }

            SnapshotMemberCollection members = new SnapshotMemberCollection();

            foreach (ObjectCompareResult result in ObjectCompare.Compare(_mirrorObject, _object))
            {
                members.Add(result.MemberName, result.SourceValue, result.CompareValue);
            }

            foreach (SnapshotMember member in members)
            {
                member.SetMember(_object, SnapshotMember.EnumMemberValue.OldValue);
            }

            _mirrorObject = null;
        }
Exemple #4
0
 public SnapshotMemberCollection(SnapshotMemberCollection value)
 {
     this.AddRange(value);
 }
Exemple #5
0
 public SnapshotMemberEnumerator(SnapshotMemberCollection mappings)
 {
     this.temp           = ((IEnumerable)(mappings));
     this.baseEnumerator = temp.GetEnumerator();
 }