/// <summary> /// Consturct a SyncNodeStamp from a ChangeLogRecord. /// </summary> /// <param name="record">The record to use.</param> internal SyncNodeInfo(ChangeLogRecord record) { this.ID = record.EventID; this.LocalIncarnation = record.SlaveRev; this.MasterIncarnation = record.MasterRev; this.NodeType = GetSyncNodeType(record.Type.ToString()); switch (record.Operation) { case ChangeLogRecord.ChangeLogOp.Changed: this.Operation = SyncOperation.Change; break; case ChangeLogRecord.ChangeLogOp.Created: this.Operation = SyncOperation.Create; break; case ChangeLogRecord.ChangeLogOp.Deleted: this.Operation = SyncOperation.Delete; break; case ChangeLogRecord.ChangeLogOp.Renamed: this.Operation = SyncOperation.Rename; break; default: this.Operation = SyncOperation.Unknown; break; } }
/// <summary> /// Construct a SyncNodeStamp from a Node. /// </summary> /// <param name="node">the node to use.</param> internal SyncNodeInfo(Node node) { this.ID = node.ID; this.LocalIncarnation = node.LocalIncarnation; this.MasterIncarnation = node.MasterIncarnation; this.NodeType = GetSyncNodeType(node.Type); this.Operation = node.Type == NodeTypes.TombstoneType ? SyncOperation.Delete : SyncOperation.Unknown; }
/// <summary> /// Construct a SyncNodeInfo from a stream. /// </summary> /// <param name="reader"></param> internal SyncNodeInfo(BinaryReader reader) { this.ID = new Guid(reader.ReadBytes(16)).ToString(); this.LocalIncarnation = reader.ReadUInt64(); this.MasterIncarnation = reader.ReadUInt64(); this.NodeType = (SyncNodeType)reader.ReadByte(); this.Operation = (SyncOperation)reader.ReadByte(); }