示例#1
0
 public override void SerializeInto(BinaryWriter writer)
 {
     base.SerializeInto(writer);
     writer.Write(Objects.Length);
     writer.Write(VMSerializableUtils.ToByteArray(Objects));
     writer.Write(Graphics);
 }
示例#2
0
 public void SerializeInto(BinaryWriter writer)
 {
     writer.Write((byte)LightType);
     writer.Write((byte)DarkType);
     writer.Write(Heights.Length);
     writer.Write(VMSerializableUtils.ToByteArray(Heights));
     writer.Write(GrassState.Length);
     writer.Write(GrassState);
 }
 public void SerializeInto(BinaryWriter writer)
 {
     writer.Write(MultiTile);
     writer.Write(Name);
     writer.Write(Price);
     writer.Write(Objects.Length);
     writer.Write(VMSerializableUtils.ToByteArray(Objects));
     foreach (var item in Offsets)
     {
         item.SerializeInto(writer);
     }
 }
示例#4
0
        public virtual void SerializeInto(BinaryWriter writer)
        {
            writer.Write(ObjectID);
            writer.Write(PersistID);
            PlatformState.SerializeInto(writer);
            writer.Write(ObjectData.Length);
            writer.Write(VMSerializableUtils.ToByteArray(ObjectData));
            //foreach (var item in ObjectData) writer.Write(item);
            writer.Write(MyList.Length);
            writer.Write(VMSerializableUtils.ToByteArray(MyList));
            //foreach (var item in MyList) writer.Write(item);

            writer.Write(Headline != null);
            if (Headline != null)
            {
                Headline.SerializeInto(writer);
            }

            writer.Write(GUID);
            writer.Write(MasterGUID);

            writer.Write(MainParam); //parameters passed to main on creation.
            writer.Write(MainStackOBJ);

            writer.Write(Contained.Length); //object ids
            writer.Write(VMSerializableUtils.ToByteArray(Contained));
            //foreach (var item in Contained) writer.Write(item);
            writer.Write(Container);
            writer.Write(ContainerSlot);

            writer.Write(Attributes.Length);
            writer.Write(VMSerializableUtils.ToByteArray(Attributes));
            //foreach (var item in Attributes) writer.Write(item);
            writer.Write(MeToObject.Length);
            foreach (var item in MeToObject)
            {
                item.SerializeInto(writer);
            }
            writer.Write(MeToPersist.Length);
            foreach (var item in MeToPersist)
            {
                item.SerializeInto(writer);
            }

            writer.Write(DynamicSpriteFlags); /** Used to show/hide dynamic sprites **/
            writer.Write(DynamicSpriteFlags2);
            Position.SerializeInto(writer);

            writer.Write(TimestampLockoutCount);
            writer.Write(LightColor.PackedValue);
        }
        public override void SerializeInto(BinaryWriter writer)
        {
            base.SerializeInto(writer);

            writer.Write(Animations.Length);
            foreach (var item in Animations)
            {
                item.SerializeInto(writer);
            }

            writer.Write(CarryAnimationState != null);
            if (CarryAnimationState != null)
            {
                CarryAnimationState.SerializeInto(writer);
            }

            writer.Write(Message);
            writer.Write(MessageTimeout);

            writer.Write(MotiveChanges.Length);
            foreach (var item in MotiveChanges)
            {
                item.SerializeInto(writer);
            }
            MotiveDecay.SerializeInto(writer);
            writer.Write(PersonData.Length);
            writer.Write(VMSerializableUtils.ToByteArray(PersonData));
            //foreach (var item in PersonData) { writer.Write(item); }
            writer.Write(MotiveData.Length);
            writer.Write(VMSerializableUtils.ToByteArray(MotiveData));
            //foreach (var item in MotiveData) { writer.Write(item); }
            writer.Write(HandObject);
            writer.Write(RadianDirection);

            writer.Write(KillTimeout);

            DefaultSuits.SerializeInto(writer);
            writer.Write(BoundAppearances.Length);
            foreach (var item in BoundAppearances)
            {
                writer.Write(item);
            }

            writer.Write(BodyOutfit);
            writer.Write(HeadOutfit);
            writer.Write((byte)SkinTone);
        }
 public virtual void SerializeInto(BinaryWriter writer)
 {
     writer.Write(RoutineID);
     writer.Write(InstructionPointer);
     writer.Write(Caller);
     writer.Write(Callee);
     writer.Write(StackObject);
     writer.Write(CodeOwnerGUID);
     writer.Write((Locals == null)?-1:Locals.Length);
     if (Locals != null)
     {
         writer.Write(VMSerializableUtils.ToByteArray(Locals));
     }
     writer.Write((Args == null) ? -1 : Args.Length);
     if (Args != null)
     {
         writer.Write(VMSerializableUtils.ToByteArray(Args));
     }
     writer.Write(DiscardResult);
     writer.Write(ActionTree);
 }
示例#7
0
        public static Tuple <byte[], int, int> BitmapReader(Stream str)
        {
            Bitmap image = BitmapFactory.DecodeStream(str, null, new BitmapFactory.Options
            {
                InScaled           = false,
                InDither           = false,
                InJustDecodeBounds = false,
                InPurgeable        = true,
                InInputShareable   = true,
            });


            var width  = image.Width;
            var height = image.Height;

            int[] pixels = new int[width * height];
            if ((width != image.Width) || (height != image.Height))
            {
                using (Bitmap imagePadded = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888))
                {
                    Canvas canvas = new Canvas(imagePadded);
                    canvas.DrawARGB(0, 0, 0, 0);
                    canvas.DrawBitmap(image, 0, 0, null);
                    imagePadded.GetPixels(pixels, 0, width, 0, 0, width, height);
                    imagePadded.Recycle();
                }
            }
            else
            {
                image.GetPixels(pixels, 0, width, 0, 0, width, height);
            }
            image.Recycle();

            // Convert from ARGB to ABGR
            ConvertToABGR(height, width, pixels);

            image.Dispose();

            return(new Tuple <byte[], int, int>(Premult(VMSerializableUtils.ToByteArray(pixels)), width, height));
        }
        public void SerializeInto(BinaryWriter writer)
        {
            writer.Write(Stack.Length);
            foreach (var item in Stack)
            {
                writer.Write((byte)((item is VMRoutingFrameMarshal) ? 1 : 0)); //mode, 1 for routing frame
                item.SerializeInto(writer);
            }

            writer.Write(Queue.Length);
            foreach (var item in Queue)
            {
                item.SerializeInto(writer);
            }
            writer.Write(ActiveQueueBlock);

            writer.Write(VMSerializableUtils.ToByteArray(TempRegisters));
            foreach (var item in TempXL)
            {
                writer.Write(item);
            }
            writer.Write((byte)LastStackExitCode);

            writer.Write(BlockingState != null);
            if (BlockingState != null)
            {
                VMAsyncState.SerializeGeneric(writer, BlockingState);
            }
            writer.Write(EODConnection != null);
            if (EODConnection != null)
            {
                EODConnection.SerializeInto(writer);
            }
            writer.Write(Interrupt);

            writer.Write(ActionUID);
            writer.Write(DialogCooldown);

            writer.Write(ScheduleIdleStart);
        }
        public void SerializeInto(BinaryWriter writer)
        {
            writer.Write(ObjectID);
            writer.Write(GUID);
            writer.Write(MasterGUID);
            Position.SerializeInto(writer);
            writer.Write((byte)Direction);
            writer.Write(Graphic);
            writer.Write(DynamicSpriteFlags);
            writer.Write(DynamicSpriteFlags2);

            writer.Write(Contained.Length);
            writer.Write(VMSerializableUtils.ToByteArray(Contained));
            writer.Write(Container);
            writer.Write(ContainerSlot);

            writer.Write(Flags);
            writer.Write(Flags2);
            writer.Write(WallPlacementFlags);
            writer.Write(PlacementFlags);
            writer.Write(AllowedHeightFlags);
        }
示例#10
0
 public virtual void SerializeInto(BinaryWriter writer)
 {
     writer.Write(Target);
     writer.Write(Values.Length);
     writer.Write(VMSerializableUtils.ToByteArray(Values));
 }