Example #1
0
        public override object Clone()
        {
            WZConvex c = new WZConvex();

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

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

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

            return c;
        }
Example #3
0
 private static WZConvex ConvexFromEntry(IMGEntry entry)
 {
     WZConvex obj = new WZConvex();
     for (int i = 0; i < entry.childs.Count; i++)
     {
         obj.objects.Add(ComplexFromEntry(entry.childs[i]));
     }
     return obj;
 }
Example #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);
        }
Example #5
0
 private static void CreateEntry(IMGEntry parent, WZConvex obj)
 {
     int i = 0;
     foreach(WZObject o in obj.objects)
     {
         IMGEntry e = new IMGEntry(parent);
         CreateEntry(e, o);
         e.Name = "Convex" + (i++).ToString();
         parent.Add(e);
     }
 }