예제 #1
0
 internal WZDelayedProperty(string name, WZObject parent, WZImage container, WZBinaryReader r, bool children,
                            WZObjectType type)
     : base(name, parent, default(T), container, children, type)
 {
     _offset = r.Position;
     _parsed = Parse(r, true, out _value);
     _r      = r;
 }
예제 #2
0
 internal WZSubProperty(string name, WZObject parent, WZBinaryReader r, WZImage container)
     : base(name, parent, default(WZNothing), container, true, WZObjectType.SubProperty)
 {
     foreach (WZObject c in WZExtendedParser.ParsePropertyList(r, this, Image, Image._encrypted))
     {
         Add(c);
     }
 }
예제 #3
0
 internal WZImage(string name, WZObject parent, WZFile file, WZBinaryReader reader)
     : base(name, parent, file, true, WZObjectType.Image)
 {
     _r = reader;
     if ((file._flag & WZReadSelection.EagerParseImage) == WZReadSelection.EagerParseImage)
     {
         Parse();
     }
 }
예제 #4
0
        internal static List <WZObject> ParsePropertyList(WZBinaryReader r, WZObject parent, WZImage f, bool encrypted)
        {
            int             num = r.ReadWZInt();
            List <WZObject> ret = new List <WZObject>(num);

            for (int i = 0; i < num; ++i)
            {
                string name = r.ReadWZStringBlock(encrypted);
                byte   type = r.ReadByte();
                switch (type)
                {
                case 0:
                    ret.Add(new WZNullProperty(name, parent, f));
                    break;

                case 0x0B:
                case 2:
                    ret.Add(new WZUInt16Property(name, parent, r, f));
                    break;

                case 0x13:
                case 3:
                    ret.Add(new WZInt32Property(name, parent, r, f));
                    break;

                case 0x14:
                    ret.Add(new WZInt64Property(name, parent, r, f));
                    break;

                case 4:
                    ret.Add(new WZSingleProperty(name, parent, r, f));
                    break;

                case 5:
                    ret.Add(new WZDoubleProperty(name, parent, r, f));
                    break;

                case 8:
                    ret.Add(new WZStringProperty(name, parent, r, f));
                    break;

                case 9:
                    uint blockLen = r.ReadUInt32();
                    ret.Add(ParseExtendedProperty(name, r.Clone(), parent, f, encrypted));
                    r.Skip(blockLen);
                    break;

                default:
                    return
                        (WZUtil.Die <List <WZObject> >(
                             $"Unknown property type {type} at ParsePropertyList"));
                }
            }
            return(ret);
        }
예제 #5
0
        internal WZConvexProperty(string name, WZObject parent, WZBinaryReader r, WZImage container)
            : base(name, parent, default(WZNothing), container, true, WZObjectType.Convex)
        {
            int count = r.ReadWZInt();

            for (int i = 0; i < count; ++i)
            {
                Add(WZExtendedParser.ParseExtendedProperty(i.ToString(CultureInfo.InvariantCulture), r, this, Image,
                                                           Image._encrypted));
            }
        }
예제 #6
0
        private WZObject ResolveFully()
        {
            HashSet <WZObject> traversed = new HashSet <WZObject> {
                this
            };
            WZObject ret = this;

            while (ret is WZUOLProperty)
            {
                ret = ((WZUOLProperty)ret).Target;
                if (ret == null || traversed.Contains(ret))
                {
                    return(null);
                }
                traversed.Add(ret);
            }
            return(ret);
        }
예제 #7
0
 internal WZCanvasProperty(string name, WZObject parent, WZBinaryReader br, WZImage container)
     : base(name, parent, container, br, true, WZObjectType.Canvas)
 {
 }
예제 #8
0
 internal WZStringProperty(string name, WZObject parent, WZBinaryReader reader, WZImage container)
     : base(name, parent, container, reader, false, WZObjectType.String)
 {
 }
예제 #9
0
 internal WZDoubleProperty(string name, WZObject parent, WZBinaryReader reader, WZImage container)
     : base(name, parent, reader.ReadDouble(), container, false, WZObjectType.Double)
 {
 }
예제 #10
0
 internal WZSingleProperty(string name, WZObject parent, WZBinaryReader reader, WZImage container)
     : base(name, parent, ReadSingle(reader), container, false, WZObjectType.Single)
 {
 }
예제 #11
0
 internal WZInt64Property(string name, WZObject parent, WZBinaryReader reader, WZImage container)
     : base(name, parent, reader.ReadWZLong(), container, false, WZObjectType.Int64)
 {
 }
예제 #12
0
 internal WZNullProperty(string name, WZObject parent, WZImage container)
     : base(name, parent, default(WZNothing), container, false, WZObjectType.Null)
 {
 }
예제 #13
0
 internal WZUOLProperty(string name, WZObject parent, WZBinaryReader reader, WZImage container)
     : base(
         name, parent, string.Intern(reader.ReadWZStringBlock(container._encrypted)), container, false,
         WZObjectType.UOL)
 {
 }
예제 #14
0
 internal WZPointProperty(string name, WZObject parent, WZBinaryReader wzbr, WZImage container)
     : base(name, parent, new Point(wzbr.ReadWZInt(), wzbr.ReadWZInt()), container, false, WZObjectType.Point)
 {
 }
예제 #15
0
 internal WZProperty(string name, WZObject parent, T value, WZImage container, bool children, WZObjectType type)
     : base(name, parent, container.File, children, type)
 {
     _value = value;
     Image  = container;
 }
예제 #16
0
 internal WZUInt16Property(string name, WZObject parent, WZBinaryReader reader, WZImage container)
     : base(name, parent, reader.ReadUInt16(), container, false, WZObjectType.UInt16)
 {
 }
예제 #17
0
        internal static WZObject ParseExtendedProperty(string name, WZBinaryReader r, WZObject parent, WZImage f,
                                                       bool encrypted)
        {
            string type = r.ReadWZStringBlock(encrypted);

            switch (type)
            {
            case "Property":
                r.Skip(2);
                return(new WZSubProperty(name, parent, r, f));

            case "Canvas":
                return(new WZCanvasProperty(name, parent, r, f));

            case "Shape2D#Vector2D":
                return(new WZPointProperty(name, parent, r, f));

            case "Shape2D#Convex2D":
                return(new WZConvexProperty(name, parent, r, f));

            case "Sound_DX8":
                return(new WZAudioProperty(name, parent, r, f));

            case "UOL":
                r.Skip(1);
                return(new WZUOLProperty(name, parent, r, f));

            default:
                return(WZUtil.Die <WZObject>($"Unknown ExtendedProperty type \"{type}\""));
            }
        }