private int CopyUnindexedId(bool doRegister) { int orig = _source.ReadInt(); // TODO: There is no test case for the zero case if (orig == 0) { _target.WriteInt(0); return(0); } int mapped = -1; try { mapped = _services.StrictMappedID(orig); } catch (MappingNotFoundException) { mapped = _services.TargetNewId(); _services.MapIDs(orig, mapped, false); if (doRegister) { _services.RegisterUnindexed(orig); } } _target.WriteInt(mapped); return(mapped); }
public static void ProcessCopy(IDefragmentServices services, int sourceID, ISlotCopyHandler command, ByteArrayBuffer sourceReader) { int targetID = services.StrictMappedID(sourceID); Slot targetSlot = services.AllocateTargetSlot(sourceReader.Length()); services.Mapping().MapId(targetID, targetSlot); Db4objects.Db4o.Internal.DefragmentContextImpl context = new Db4objects.Db4o.Internal.DefragmentContextImpl (sourceReader, services); command.ProcessCopy(context); services.TargetWriteBytes(context, targetSlot.Address()); }