Beispiel #1
0
        public override object Clone()
        {
            WZProperty c = new WZProperty();

            foreach (WZObject obj in objects)
            {
                c.objects.Add(obj.Clone() as WZObject);
            }

            return c;
        }
Beispiel #2
0
        public override object Clone()
        {
            WZProperty c = new WZProperty();

            foreach (WZObject obj in objects)
            {
                c.objects.Add(obj.Clone() as WZObject);
            }

            return(c);
        }
Beispiel #3
0
 private static WZProperty PropertyFromEntry(IMGEntry entry)
 {
     WZProperty obj = new WZProperty();
     for (int i = 0; i < entry.childs.Count; i++)
     {
         obj.objects.Add(ObjectFromEntry(entry.childs[i]));
     }
     return obj;
 }
Beispiel #4
0
        WZObject ReadComplex(int end)
        {
            string type = ReadString();
            switch (type)
            {
                case "Property":
                    {
                        WZProperty p = new WZProperty();
                        file.ReadShort(); // null

                        int count = file.ReadValue();

                        for (int i = 0; i < count; i++)
                        {
                            p.objects.Add(ReadObject());
                        }

                        if (end != 0 && end != file.file.BaseStream.Position) throw new Exception("...");
                        return p;
                    }
                case "Shape2D#Convex2D":
                    {
                        WZConvex c = new WZConvex();

                        int count = file.ReadValue();

                        for (int i = 0; i < count; i++)
                        {
                            c.objects.Add(ReadComplex());
                        }

                        if (end != 0 && end != file.file.BaseStream.Position) throw new Exception("...");

                        return c;
                    }
                case "Shape2D#Vector2D":
                    {
                        int x = file.ReadValue();
                        int y = file.ReadValue();


                        if (end != 0 && end != file.file.BaseStream.Position) throw new Exception("...");
                        return new WZVector(x, y);
                    }
                case "Canvas":
                    {
                        WZCanvas c = new WZCanvas();
                        c.file = file.file;

                        file.ReadByte(); // null

                        if (file.ReadByte() != 0)
                        {
                            file.ReadShort(); // null
                            int count = file.ReadValue();

                            for (int i = 0; i < count; i++)
                            {
                                c.objects.Add(ReadObject());
                            }
                        }

                        c.width = file.ReadValue();
                        c.height = file.ReadValue();
                        int format = file.ReadValue();
                        c.format = (WZCanvas.ImageFormat)(file.ReadValue() + format);
                        file.ReadInt(); // null
                        c.size = file.ReadInt();
                        c.offset = (int)file.file.BaseStream.Position;
                        file.file.BaseStream.Seek(c.size, SeekOrigin.Current);

                        if (end != 0 && end != file.file.BaseStream.Position) throw new Exception("...");

                        return c;
                    }
                case "Sound_DX8":
                    {
                        // TODO
                        file.file.BaseStream.Seek(end, SeekOrigin.Begin);

                        if (end != 0 && end != file.file.BaseStream.Position) throw new Exception("...");
                        return new WZSound();
                    }
                case "UOL":
                    {
                        file.ReadByte(); // null

                        //if (end != 0 && end != file.file.BaseStream.Position) throw new Exception("...");

                        return new WZUOL(ReadString());
                    }

            }
            throw new Exception("Invalid Object type: " + type);
        }
Beispiel #5
0
 public IMGEntry(WZProperty p)
 {
     CreateEntry(this, p);
 }
Beispiel #6
0
 private static void CreateEntry(IMGEntry parent, WZProperty obj)
 {
     CreateEntryChilds(parent, obj);
 }