Exemple #1
0
        public bool ReadObject(ref SpanReader reader, out object? @object)
        {
            var id = reader.ReadVInt64();

            if (id == 0)
            {
                @object = null;
                return(false);
            }

            if (id <= int.MinValue || id > 0)
            {
                @object = Transaction.Get((ulong)id);
                return(false);
            }

            var ido = (int)(-id) - 1;
            var o   = RetrieveObj(ido);

            if (o != null)
            {
                if (!(o is IMemorizedPosition mp))
                {
                    @object = o;
                    return(false);
                }

                PushReturningPosition(reader.GetCurrentPosition());
                mp.Restore(ref reader);
            }
            else
            {
                PushReturningPosition(-1);
            }

            _lastIdOfObj = ido;
            @object      = null;
            return(true);
        }