public void Read(BinaryInputStream s)
        {
            chipID = s.ReadInt32();
            resourceID = s.ReadInt32();

            src_x = s.ReadInt16();
            src_y = s.ReadInt16();
            width = s.ReadInt16();
            height = s.ReadInt16();

            s.ReadInt32(0);
            s.ReadInt32(0);
            s.ReadInt32(0);
            s.ReadInt32(0);
            s.ReadInt16(0);

            collision_flag = s.ReadInt16();
            collision_x = s.ReadInt16();
            collision_y = s.ReadInt16();
            collision_w = s.ReadInt16();
            collision_h = s.ReadInt16();

            s.ReadInt32(0);
            s.ReadInt32(0);

            s.ReadInt32(0);
            s.ReadInt32();
        }
        public void Read(BinaryInputStream s)
        {
            properties.ReadFromStream(s);
            code.Read(s);
            layers = s.ReadObjectArray<ActLayerObject>();
            resources = s.ReadObjectArray<AbstractActResourceObject>();

            SetupDefaultRenderLayers();
        }
 public void Read(BinaryInputStream s)
 {
     properties.ReadFromStream(s);
     keys = s.ReadObjectArray<ActKeyObject>();
     if (keys.Count != 1)
     {
         Task.SendError("layer should contain one key");
     }
     s.ReadInt32(0);
     code.Read(s);
 }
        public void Read(BinaryInputStream s)
        {
            int size = s.ReadInt32();
            int len = s.ReadInt32();
            if (len != 56)
            {
                throw new Exception("invalid element size in layout");
            }
            chips = s.ReadSerializableArray(size, bs => new ChipElement());

            resources = s.ReadObjectArray<AbstractResourceInfoObject>();
        }
 public void Read(BinaryInputStream s)
 {
     properties.ReadFromStream(s);
     if (s.ReadBool() == false)
     {
         Task.SendError("key should contain one layout");
     }
     layout = s.ReadObject<AbstractActLayoutObject>();
     if (layout == null || !(layout is Act2DMapLayoutObject))
     {
         Task.SendError("only support Act2DMapLayout in key");
     }
 }
        public override void Read(BinaryInputStream s)
        {
            properties.ReadFromStream(s);

            int size = s.ReadInt32();
            int len = s.ReadInt32();
            switch (len)
            {
                case 24: is_short = true; break;
                case 40: is_short = false; break;
                default:
                    throw new Exception("invalid element size in layout");
            }

            elements = s.ReadSerializableArray(size, bs => new Element());
        }
        public void ReadFromStream(BinaryInputStream s, bool is_short_version = false)
        {
            List<Action<BinaryInputStream>> readers = new List<Action<BinaryInputStream>>();

            if (!is_short_version)
            {
                s.ReadBool(true);
            }

            int size = s.ReadInt32();
            for (int i = 0; i < size; ++i)
            {
                string n = s.ReadString();
                int t = s.ReadInt32();
                readers.Add(SetField(n, t));
            }
            foreach (var ac in readers)
            {
                ac(s);
            }
        }
 public static McdObject ReadMcdFromFile(string filename)
 {
     try
     {
         using (FileStream f = File.Open(filename, FileMode.Open))
         {
             using (BinaryReader br = new BinaryReader(f))
             {
                 BinaryInputStream bs = new BinaryInputStream(br);
                 bs.ReadInt32(0x434D4432);
                 bs.ReadInt32(2);
                 bs.ReadInt32(0);
                 McdObject mcd = new McdObject();
                 mcd.Read(bs);
                 return mcd;
             }
         }
     }
     catch
     {
         return null;
     }
 }
 public static ActObject ReadActFromFile(string filename)
 {
     try
     {
         using (FileStream f = File.Open(filename, FileMode.Open))
         {
             using (BinaryReader br = new BinaryReader(f))
             {
                 BinaryInputStream bs = new BinaryInputStream(br);
                 bs.ReadInt32(0x31544341);
                 bs.ReadInt32(1);
                 bs.ReadInt32(0);
                 ActObject act = new ActObject();
                 act.Read(bs);
                 return act;
             }
         }
     }
     catch
     {
         return null;
     }
 }
 public override void Read(BinaryInputStream s)
 {
     properties.ReadFromStream(s, true);
 }
 public abstract void Read(BinaryInputStream s);
 public void Read(BinaryInputStream s)
 {
     properties.ReadFromStream(s);
     code = s.ReadString();
 }
 public void ReadField(object obj, PropertyInfo f, BinaryInputStream s)
 {
     f.SetValue(obj, typeof(BinaryInputStream).GetMethod(reader).Invoke(s, null));
 }
 public void Read(BinaryInputStream s)
 {
     resourceID = s.ReadInt32();
     x = s.ReadInt32();
     y = s.ReadInt32();
     scale_x = s.ReadFloat();
     scale_y = s.ReadFloat();
     rotate = s.ReadFloat();
     aabb_x = s.ReadInt32();
     aabb_y = s.ReadInt32();
     aabb_w = s.ReadInt32();
     aabb_h = s.ReadInt32();
 }