WriteBuffer() private method

private WriteBuffer ( TargetMemoryAccess target, byte data ) : void
target TargetMemoryAccess
data byte
return void
Example #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);
        }
Example #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);
        }