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); } }
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; }
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(); } }
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); }
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)); } }
private WZObject ResolveFully() { HashSet <WZObject> traversed = new HashSet <WZObject> { this }; WZObject ret = this; while (ret is WZLinkProperty) { ret = ((WZLinkProperty)ret).Target; if (ret == null || traversed.Contains(ret)) { return(null); } traversed.Add(ret); } return(ret); }
internal WZDoubleProperty(string name, WZObject parent, WZBinaryReader reader, WZImage container) : base(name, parent, reader.ReadDouble(), container, false, WZObjectType.Double) { }
internal WZSingleProperty(string name, WZObject parent, WZBinaryReader reader, WZImage container) : base(name, parent, ReadSingle(reader), container, false, WZObjectType.Single) { }
internal WZInt64Property(string name, WZObject parent, WZBinaryReader reader, WZImage container) : base(name, parent, reader.ReadWZLong(), container, false, WZObjectType.Int64) { }
internal WZUInt16Property(string name, WZObject parent, WZBinaryReader reader, WZImage container) : base(name, parent, reader.ReadUInt16(), container, false, WZObjectType.UInt16) { }
internal WZNullProperty(string name, WZObject parent, WZImage container) : base(name, parent, default(WZNothing), container, false, WZObjectType.Null) { }
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 WZLinkProperty(name, parent, r, f)); default: return(WZUtil.Die <WZObject>($"Unknown ExtendedProperty type \"{type}\"")); } }
internal WZPointProperty(string name, WZObject parent, WZBinaryReader wzbr, WZImage container) : base(name, parent, new Point(wzbr.ReadWZInt(), wzbr.ReadWZInt()), container, false, WZObjectType.Point) { }
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; }
internal WZStringProperty(string name, WZObject parent, WZBinaryReader reader, WZImage container) : base(name, parent, container, reader, false, WZObjectType.String) { }
internal WZLinkProperty(string name, WZObject parent, WZBinaryReader reader, WZImage container) : base( name, parent, string.Intern(reader.ReadWZStringBlock(container._encrypted)), container, false, WZObjectType.Link) { }
internal WZCanvasProperty(string name, WZObject parent, WZBinaryReader br, WZImage container) : base(name, parent, container, br, true, WZObjectType.Canvas) { }