Пример #1
0
 public void AddProperty(WzExtendedProperty prop)
 {
     prop.extendedProperty.Parent      = this;
     prop.extendedProperty.ParentImage = this.ParentImage;
     this.properties.Add(prop);
 }
Пример #2
0
        public void ParseImage()
        {
            long position = this.wzReader.BaseStream.Position;

            this.wzReader.BaseStream.Position = this.offset;
            if (((this.wzReader.ReadByte() == 0x73) && (WzTools.ReadDecodedString(this.wzReader) == "Property")) && (this.wzReader.ReadUInt16() == 0))
            {
                int num2 = WzTools.ReadCompressedInt(this.wzReader);
                for (int i = 0; i < num2; i++)
                {
                    byte   num4;
                    string propName = this.DumpBlock();
                    switch (this.wzReader.ReadByte())
                    {
                    case 0:
                    {
                        this.properties.Add(new WzNullProperty(propName)
                            {
                                Parent = this, ParentImage = this
                            });
                        continue;
                    }

                    case 1:
                    case 6:
                    case 7:
                    case 10:
                    {
                        continue;
                    }

                    case 2:
                    case 11:
                    {
                        this.properties.Add(new WzUnsignedShortProperty(propName, this.wzReader.ReadUInt16())
                            {
                                Parent = this, ParentImage = this
                            });
                        continue;
                    }

                    case 3:
                    {
                        this.properties.Add(new WzCompressedIntProperty(propName, WzTools.ReadCompressedInt(this.wzReader))
                            {
                                Parent = this, ParentImage = this
                            });
                        continue;
                    }

                    case 4:
                    {
                        num4 = this.wzReader.ReadByte();
                        if (num4 != 0x80)
                        {
                            break;
                        }
                        this.properties.Add(new WzByteFloatProperty(propName, this.wzReader.ReadSingle())
                            {
                                Parent = this, ParentImage = this
                            });
                        continue;
                    }

                    case 5:
                    {
                        this.properties.Add(new WzDoubleProperty(propName, this.wzReader.ReadDouble())
                            {
                                Parent = this, ParentImage = this
                            });
                        continue;
                    }

                    case 8:
                    {
                        this.properties.Add(new WzStringProperty(propName, this.DumpBlock())
                            {
                                Parent = this
                            });
                        continue;
                    }

                    case 9:
                    {
                        WzExtendedProperty property;
                        int eob = (int)(this.wzReader.ReadUInt32() + this.wzReader.BaseStream.Position);
                        property             = new WzExtendedProperty((int)this.offset, eob, propName); /*{
                                                                                                         * Parent = property.ParentImage = this
                                                                                                         * };*/
                        property.Parent      = this;
                        property.ParentImage = this;
                        property.ParseExtendedProperty(this.wzReader);
                        this.properties.Add(property);
                        if (this.wzReader.BaseStream.Position != eob)
                        {
                            this.wzReader.BaseStream.Position = eob;
                        }
                        continue;
                    }

                    default:
                    {
                        continue;
                    }
                    }
                    if (num4 == 0)
                    {
                        this.properties.Add(new WzByteFloatProperty(propName, 0f)
                        {
                            Parent = this, ParentImage = this
                        });
                    }
                }
                this.parsed = true;
            }
        }
Пример #3
0
        internal void ExtractMore(int eob, string name, string iname)
        {
            if (iname == "")
            {
                iname = WzTools.ReadDecodedString(this.wzReader);
            }
            string str3 = iname;

            if (str3 != null)
            {
                if (str3 != "Property")
                {
                    if (str3 != "Canvas")
                    {
                        WzVectorProperty property19;
                        if (str3 != "Shape2D#Vector2D")
                        {
                            if (str3 != "Shape2D#Convex2D")
                            {
                                if (str3 != "Sound_DX8")
                                {
                                    if (str3 == "UOL")
                                    {
                                        Stream stream4 = this.wzReader.BaseStream;
                                        stream4.Position += 1L;
                                        switch (this.wzReader.ReadByte())
                                        {
                                        case 0:
                                            this.extendedProperty = new WzUOLProperty(name, WzTools.ReadDecodedString(this.wzReader))
                                            {
                                                Parent = this.parent, ParentImage = this.imgParent
                                            };
                                            return;

                                        case 1:
                                            this.extendedProperty = new WzUOLProperty(name, WzTools.ReadDecodedStringAtOffsetAndReset(this.wzReader, (long)(this.offset + this.wzReader.ReadInt32())))
                                            {
                                                Parent = this.parent, ParentImage = this.imgParent
                                            };
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        this.WriteFile("未知的extendedProperty:" + str3);
                                    }

                                    return;
                                }
                                WzSoundProperty property23 = new WzSoundProperty(name)
                                {
                                    Parent      = this.parent,
                                    ParentImage = this.imgParent
                                };
                                property23.ParseSound(this.wzReader);
                                this.extendedProperty = property23;
                                return;
                            }
                            WzConvexProperty property20 = new WzConvexProperty(name)
                            {
                                Parent      = this.parent,
                                ParentImage = this.imgParent
                            };
                            int num9 = WzTools.ReadCompressedInt(this.wzReader);
                            for (int i = 0; i < num9; i++)
                            {
                                WzExtendedProperty prop = new WzExtendedProperty(this.offset, name)
                                {
                                    Parent      = property20,
                                    ParentImage = this.imgParent
                                };
                                prop.ParseExtendedProperty(this.wzReader);
                                property20.AddProperty(prop);
                            }
                            this.extendedProperty = property20;
                            return;
                        }
                        property19 = new WzVectorProperty(name)
                        {
                            Parent      = this.parent,
                            ParentImage = this.imgParent,
                            X           = new WzCompressedIntProperty("X", WzTools.ReadCompressedInt(this.wzReader)) /*{ Parent = property19, ParentImage = this.imgParent }*/,
                            Y           = new WzCompressedIntProperty("Y", WzTools.ReadCompressedInt(this.wzReader)) /*{ Parent = property19, ParentImage = this.imgParent }*/
                        };
                        this.extendedProperty = property19;
                        return;
                    }
                }
                else
                {
                    WzSubProperty property = new WzSubProperty(name)
                    {
                        Parent      = this.parent,
                        ParentImage = this.imgParent
                    };
                    Stream stream1 = this.wzReader.BaseStream;
                    stream1.Position += 2L;
                    int num = WzTools.ReadCompressedInt(this.wzReader);
                    for (int j = 0; j < num; j++)
                    {
                        byte   num3;
                        string propName  = this.DumpBlock();
                        byte   propValue = this.wzReader.ReadByte();
                        switch (propValue)
                        {
                        case 0:
                        {
                            property.AddProperty(new WzNullProperty(propName)
                                {
                                    Parent = property, ParentImage = this.imgParent
                                });
                            continue;
                        }

                        case 1:
                        case 6:
                        case 7:
                        case 10:
                        {
                            continue;
                        }

                        case 2:
                        case 11:
                        {
                            property.AddProperty(new WzUnsignedShortProperty(propName, this.wzReader.ReadUInt16())
                                {
                                    Parent = property, ParentImage = this.imgParent
                                });
                            continue;
                        }

                        case 3:
                        case 19:     // Map.wz 992001100 add
                        {
                            property.AddProperty(new WzCompressedIntProperty(propName, WzTools.ReadCompressedInt(this.wzReader))
                                {
                                    Parent = property, ParentImage = this.imgParent
                                });
                            continue;
                        }

                        case 20:     // Character.wz  add
                        {
                            property.AddProperty(new WzCompressedIntProperty(propName, WzTools.ReadCompressedInt64(this.wzReader))
                                {
                                    Parent = property, ParentImage = this.imgParent
                                });
                            continue;
                        }

                        case 4:     // 4字节浮点数
                        {
                            num3 = this.wzReader.ReadByte();
                            if (num3 != 0x80)
                            {
                                break;
                            }
                            property.AddProperty(new WzByteFloatProperty(propName, this.wzReader.ReadSingle())
                                {
                                    Parent = property, ParentImage = this.imgParent
                                });
                            continue;
                        }

                        case 5:
                        {
                            property.AddProperty(new WzDoubleProperty(propName, this.wzReader.ReadDouble())
                                {
                                    Parent = property, ParentImage = this.imgParent
                                });
                            continue;
                        }

                        case 8:     // string
                        {
                            property.AddProperty(new WzStringProperty(propName, this.DumpBlock())
                                {
                                    Parent = property, ParentImage = this.imgParent
                                });
                            continue;
                        }

                        case 9:
                        {
                            int num4 = (int)(this.wzReader.ReadUInt32() + this.wzReader.BaseStream.Position);
                            WzExtendedProperty property2 = new WzExtendedProperty(this.offset, num4, propName)
                            {
                                Parent      = property,
                                ParentImage = this.imgParent
                            };
                            property2.ParseExtendedProperty(this.wzReader);
                            property.AddProperty(property2);
                            if (this.wzReader.BaseStream.Position != num4)
                            {
                                this.wzReader.BaseStream.Position = num4;
                            }
                            continue;
                        }

                        default:
                        {
                            this.WriteFile(this.name + " 未知的PropertyValue:" + propValue);
                            continue;
                        }
                        }
                        if (num3 == 0)
                        {
                            property.AddProperty(new WzByteFloatProperty(propName, 0f)
                            {
                                Parent = property, ParentImage = this.imgParent
                            });
                        }
                    }
                    this.extendedProperty = property;
                    return;
                }
                WzCanvasProperty property10 = new WzCanvasProperty(name)
                {
                    Parent      = this.parent,
                    ParentImage = this.imgParent
                };
                Stream baseStream = this.wzReader.BaseStream;
                baseStream.Position += 1L;
                if (this.wzReader.ReadByte() == 1)
                {
                    Stream stream3 = this.wzReader.BaseStream;
                    stream3.Position += 2L;
                    int num5 = WzTools.ReadCompressedInt(this.wzReader);
                    for (int k = 0; k < num5; k++)
                    {
                        byte   num7;
                        string str2 = this.DumpBlock();
                        switch (this.wzReader.ReadByte())
                        {
                        case 0:
                            property10.AddProperty(new WzNullProperty(str2)
                            {
                                Parent = property10, ParentImage = this.imgParent
                            });
                            goto Label_061A;

                        case 2:
                        case 11:
                            property10.AddProperty(new WzUnsignedShortProperty(str2, this.wzReader.ReadUInt16())
                            {
                                Parent = property10, ParentImage = this.imgParent
                            });
                            goto Label_061A;

                        case 3:
                            property10.AddProperty(new WzCompressedIntProperty(str2, WzTools.ReadCompressedInt(this.wzReader))
                            {
                                Parent = property10, ParentImage = this.imgParent
                            });
                            goto Label_061A;

                        case 4:
                            num7 = this.wzReader.ReadByte();
                            if (num7 != 0x80)
                            {
                                break;
                            }
                            property10.AddProperty(new WzByteFloatProperty(str2, this.wzReader.ReadSingle())
                            {
                                Parent = property10, ParentImage = this.imgParent
                            });
                            goto Label_061A;

                        case 5:
                            property10.AddProperty(new WzDoubleProperty(str2, this.wzReader.ReadDouble())
                            {
                                Parent = property10, ParentImage = this.imgParent
                            });
                            goto Label_061A;

                        case 8:
                            property10.AddProperty(new WzStringProperty(str2, this.DumpBlock())
                            {
                                Parent = property10, ParentImage = this.imgParent
                            });
                            goto Label_061A;

                        case 9:
                        {
                            int num8 = (int)(this.wzReader.ReadUInt32() + this.wzReader.BaseStream.Position);
                            WzExtendedProperty property11 = new WzExtendedProperty(this.offset, num8, str2)
                            {
                                Parent      = property10,
                                ParentImage = this.imgParent
                            };
                            property11.ParseExtendedProperty(this.wzReader);
                            property10.AddProperty(property11);
                            if (this.wzReader.BaseStream.Position != num8)
                            {
                                this.wzReader.BaseStream.Position = num8;
                            }
                            goto Label_061A;
                        }

                        default:
                            goto Label_061A;
                        }
                        if (num7 == 0)
                        {
                            property10.AddProperty(new WzByteFloatProperty(str2, 0f)
                            {
                                Parent = property10, ParentImage = this.imgParent
                            });
                        }
                        Label_061A :;
                    }
                }
                property10.PngProperty = new WzPngProperty(this.wzReader)
                {
                    Parent = property10, ParentImage = this.imgParent
                };
                this.extendedProperty = property10;
            }
        }