private void readRemoval(BinaryReader reader, NetVersion version) { TKey key = ReadKey(reader); NetVersion reassign = default(NetVersion); reassign.Read(reader); queueIncomingChange(removal: true, key, null, reassign); }
public void Read(BinaryReader reader) { NetVersion remoteVersion = default(NetVersion); remoteVersion.Read(reader); base.Read(reader, remoteVersion); Clock.netVersion.Merge(remoteVersion); }
private void readAddition(BinaryReader reader, NetVersion version) { TKey key = ReadKey(reader); NetVersion reassign = default(NetVersion); reassign.Read(reader); TField field = ReadFieldFull(reader, version); setFieldParent(field); queueIncomingChange(removal: false, key, field, reassign); }
public override void ReadFull(BinaryReader reader, NetVersion version) { reassigned.Read(reader); T remoteValue = readBaseValue(reader, version); if (remoteValue != null) { ReadValueFull(remoteValue, reader, version); } cleanSet(remoteValue); ChangeVersion.Merge(version); }
protected override void ReadDelta(BinaryReader reader, NetVersion version) { if (reader.ReadByte() == 1) { reader.ReadSkippable(delegate { NetVersion other = default(NetVersion); other.Read(reader); T val = readBaseValue(reader, version); if (val != null) { ReadValueFull(val, reader, version); } if (other.IsIndependent(reassigned)) { if (!other.IsPriorityOver(reassigned)) { if (this.OnConflictResolve != null) { this.OnConflictResolve(val, targetValue); } return; } if (this.OnConflictResolve != null) { this.OnConflictResolve(targetValue, val); } } else if (!other.IsPriorityOver(reassigned)) { return; } reassigned.Set(other); setInterpolationTarget(val); }); } else { reader.ReadSkippable(delegate { if (version.IsPrecededBy(reassigned) && targetValue != null) { ReadValueDelta(reader, version); } }); } }
public override void ReadFull(BinaryReader reader, NetVersion version) { dict.Clear(); dictReassigns.Clear(); outgoingChanges.Clear(); incomingChanges.Clear(); int count = reader.ReadInt32(); for (int i = 0; i < count; i++) { TKey key = ReadKey(reader); NetVersion reassign = default(NetVersion); reassign.Read(reader); TField field = ReadFieldFull(reader, version); dict.Add(key, field); dictReassigns.Add(key, reassign); setFieldParent(field); addedEvent(key, field); } }
private void readUpdate(BinaryReader reader, NetVersion version) { TKey key = ReadKey(reader); NetVersion reassign = default(NetVersion); reassign.Read(reader); reader.ReadSkippable(delegate { int num = incomingChanges.FindLastIndex((IncomingChange ch) => !ch.Removal && object.Equals(ch.Key, key) && reassign.Equals(ch.Reassigned)); if (num != -1) { TField field = incomingChanges[num].Field; if (this.OnValueTargetUpdated != null) { TValue fieldTargetValue = getFieldTargetValue(field); field.NetFields.Read(reader, version); updatedEvent(key, fieldTargetValue, getFieldTargetValue(field)); } else { field.NetFields.Read(reader, version); } } else if (dict.ContainsKey(key) && dictReassigns[key].Equals(reassign)) { TField val = dict[key]; if (this.OnValueTargetUpdated != null) { TValue fieldTargetValue2 = getFieldTargetValue(val); val.NetFields.Read(reader, version); updatedEvent(key, fieldTargetValue2, getFieldTargetValue(val)); } else { val.NetFields.Read(reader, version); } } }); }