public static ChangeTracker <T> Deserialize(RMap rm)
        {
            if (!rm.ContainsKey("¡RootId") || rm["¡RootId"] == null)
            {
                return(new ChangeTracker <T>());
            }

            var changeTracker = new ChangeTracker <T>();

            var rootId = rm.Get <int>("¡RootId");
            var maxId  = rootId;

            var(currNode, nextId) = Node.Deserialize(rm, rootId, changeTracker);
            changeTracker.Head    = currNode;
            changeTracker.Tail    = currNode;

            while (nextId != null)
            {
                maxId             = Max(nextId.Value, maxId);
                var(nextNode, id) = Node.Deserialize(rm, nextId.Value, changeTracker);
                nextId            = id;

                currNode.Next      = nextNode;
                nextNode.Prev      = currNode;
                currNode           = nextNode;
                changeTracker.Tail = currNode;
            }

            changeTracker.NextId = maxId + 1;
            return(changeTracker);
        }
Exemplo n.º 2
0
 private static Wrapper Deserialize(RMap rm)
 {
     return(new Wrapper()
     {
         Text = rm.Get <string>(nameof(Text))
     });
 }
        private static Person Deserialize(RMap rm)
        {
            var person = new Person
            {
                Name = rm.Get <string>(nameof(Name))
            };

            rm.WhenResolved <Person>(nameof(Relationship), p => person.Relationship = p);
            return(person);
        }
 private static KeyAndValue Deserialize(RMap rm)
 => new KeyAndValue()
 {
     Key   = rm.Get <TKey>(nameof(Key)),
     Value = rm.Get <TValue>(nameof(Value))
 };
 private static Wrapper Deserialize(RMap rm)
 => new Wrapper()
 {
     State = rm.Get <string>(nameof(State))
 };