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); }
/// <summary> /// only used by old handlers: OpenTypeHandler0, StringHandler0, ArrayHandler0. /// </summary> /// <remarks> /// only used by old handlers: OpenTypeHandler0, StringHandler0, ArrayHandler0. /// Doesn't need to work with modern IdSystems. /// </remarks> public Slot AllocateMappedTargetSlot(int sourceAddress, int length) { var slot = AllocateTargetSlot(length); _services.MapIDs(sourceAddress, slot.Address(), false); return(slot); }