WriteAddress() private method

private WriteAddress ( TargetMemoryAccess target, TargetAddress address ) : void
target TargetMemoryAccess
address TargetAddress
return void
Beispiel #1
0
        internal virtual void SetObject(TargetMemoryAccess target, TargetLocation location,
                                        TargetObject obj)
        {
            if (obj == null)
            {
                if (IsByRef)
                {
                    location.WriteAddress(target, TargetAddress.Null);
                    return;
                }

                throw new InvalidOperationException();
            }

            if (IsByRef)
            {
                if (obj.Type.IsByRef)
                {
                    location.WriteAddress(target, obj.Location.GetAddress(target));
                    return;
                }

                throw new InvalidOperationException();
            }

            if (!HasFixedSize || !obj.Type.HasFixedSize)
            {
                throw new InvalidOperationException();
            }
            if (Size != obj.Type.Size)
            {
                throw new InvalidOperationException();
            }

            byte[] contents = obj.Location.ReadBuffer(target, obj.Type.Size);
            location.WriteBuffer(target, contents);
        }
Beispiel #2
0
        internal virtual void SetObject(TargetMemoryAccess target, TargetLocation location,
						 TargetObject obj)
        {
            if (obj == null) {
                if (IsByRef) {
                    location.WriteAddress (target, TargetAddress.Null);
                    return;
                }

                throw new InvalidOperationException ();
            }

            if (IsByRef) {
                if (obj.Type.IsByRef) {
                    location.WriteAddress (target, obj.Location.GetAddress (target));
                    return;
                }

                throw new InvalidOperationException ();
            }

            if (!HasFixedSize || !obj.Type.HasFixedSize)
                throw new InvalidOperationException ();
            if (Size != obj.Type.Size)
                throw new InvalidOperationException ();

            byte[] contents = obj.Location.ReadBuffer (target, obj.Type.Size);
            location.WriteBuffer (target, contents);
        }