private void WriteUOL(WzUOLProperty node, DumpState ds, BinaryWriter bw) { ds.AddNode(node); bw.Write(ds.AddString(node.Name)); ds.AddUOL(node, bw.BaseStream.Position); bw.Write(0L); bw.Write(0L); }
private void WriteNode(WzObject node, DumpState ds, BinaryWriter bw, uint nextChildID) { ds.AddNode(node); bw.Write(ds.AddString(node.Name)); bw.Write(nextChildID); bw.Write((ushort)GetChildCount(node)); ushort type; if (node is WzDirectory || node is WzImage || node is WzSubProperty || node is WzConvexProperty || node is WzNullProperty) { type = 0; // no data; children only (8) } else if (node is WzIntProperty || node is WzShortProperty || node is WzLongProperty) { type = 1; // int32 (4) } else if (node is WzDoubleProperty || node is WzFloatProperty) { type = 2; // Double (0) } else if (node is WzStringProperty || node is WzLuaProperty) { type = 3; // String (4) } else if (node is WzVectorProperty) { type = 4; // (0) } else if (node is WzCanvasProperty) { type = 5; // (4) } else if (node is WzBinaryProperty) { type = 6; // (4) } else { throw new InvalidOperationException("Unhandled WZ node type [1]"); } bw.Write(type); if (node is WzIntProperty) { bw.Write((long)((WzIntProperty)node).Value); } else if (node is WzShortProperty) { bw.Write((long)((WzShortProperty)node).Value); } else if (node is WzLongProperty) { bw.Write(((WzLongProperty)node).Value); } else if (node is WzFloatProperty) { bw.Write((double)((WzFloatProperty)node).Value); } else if (node is WzDoubleProperty) { bw.Write(((WzDoubleProperty)node).Value); } else if (node is WzStringProperty) { bw.Write(ds.AddString(((WzStringProperty)node).Value)); } else if (node is WzVectorProperty) { Point pNode = ((WzVectorProperty)node).Pos; bw.Write(pNode.X); bw.Write(pNode.Y); } else if (node is WzCanvasProperty) { WzCanvasProperty wzcp = (WzCanvasProperty)node; bw.Write(ds.AddCanvas(wzcp)); bool flag16 = true; // export canvas if (flag16) { bw.Write((ushort)wzcp.PngProperty.GetBitmap().Width); bw.Write((ushort)wzcp.PngProperty.GetBitmap().Height); } else { bw.Write(0); } } else if (node is WzBinaryProperty) { WzBinaryProperty wzmp = (WzBinaryProperty)node; bw.Write(ds.AddMP3(wzmp)); bool flag18 = true; if (flag18) { bw.Write((uint)wzmp.GetBytes().Length); } else { bw.Write(0); } } switch (type) { case 0: bw.Write(0L); break; case 3: bw.Write(0); break; } }
private static void WriteUOL(WZUOLProperty node, DumpState ds, BinaryWriter bw) { ds.AddNode(node); bw.Write(ds.AddString(node.Name)); ds.AddUOL(node, bw.BaseStream.Position); bw.Write(0L); bw.Write(0L); }
private static void WriteNode(WZObject node, DumpState ds, BinaryWriter bw, uint nextChildID) { ds.AddNode(node); bw.Write(ds.AddString(node.Name)); bw.Write(nextChildID); bw.Write((ushort) node.ChildCount); ushort type; if (node is WZDirectory || node is WZImage || node is WZSubProperty || node is WZConvexProperty || node is WZNullProperty) type = 0; // no data; children only (8) else if (node is WZInt32Property || node is WZUInt16Property || node is WZInt64Property) type = 1; // int32 (4) else if (node is WZSingleProperty || node is WZDoubleProperty) type = 2; // Double (0) else if (node is WZStringProperty) type = 3; // String (4) else if (node is WZPointProperty) type = 4; // (0) else if (node is WZCanvasProperty) type = 5; // (4) else if (node is WZAudioProperty) type = 6; // (4) else throw new InvalidOperationException("Unhandled WZ node type [1]"); bw.Write(type); if (node is WZInt32Property) bw.Write((long) ((WZInt32Property) node).Value); else if (node is WZUInt16Property) bw.Write((long) ((WZUInt16Property) node).Value); else if (node is WZInt64Property) bw.Write(((WZInt64Property) node).Value); else if (node is WZSingleProperty) bw.Write((double) ((WZSingleProperty) node).Value); else if (node is WZDoubleProperty) bw.Write(((WZDoubleProperty) node).Value); else if (node is WZStringProperty) bw.Write(ds.AddString(((WZStringProperty) node).Value)); else if (node is WZPointProperty) { Point pNode = ((WZPointProperty) node).Value; bw.Write(pNode.X); bw.Write(pNode.Y); } else if (node is WZCanvasProperty) { WZCanvasProperty wzcp = (WZCanvasProperty) node; bw.Write(ds.AddCanvas(wzcp)); if (dumpImg) { bw.Write((ushort) wzcp.Value.Width); bw.Write((ushort) wzcp.Value.Height); wzcp.Dispose(); } else bw.Write(0); } else if (node is WZAudioProperty) { WZAudioProperty wzmp = (WZAudioProperty) node; bw.Write(ds.AddMP3(wzmp)); if (dumpSnd) { bw.Write((uint) wzmp.Value.Length); wzmp.Dispose(); } else bw.Write(0); } switch (type) { case 0: bw.Write(0L); break; case 3: bw.Write(0); break; } }
private static void WriteNode(WZObject node, DumpState ds, BinaryWriter bw, uint nextChildID) { ds.AddNode(node); bw.Write(ds.AddString(node.Name)); bw.Write(nextChildID); bw.Write((ushort)node.ChildCount); ushort type; if (node is WZDirectory || node is WZImage || node is WZSubProperty || node is WZConvexProperty || node is WZNullProperty) { type = 0; // no data; children only (8) } else if (node is WZInt32Property || node is WZUInt16Property || node is WZInt64Property) { type = 1; // int32 (4) } else if (node is WZSingleProperty || node is WZDoubleProperty) { type = 2; // Double (0) } else if (node is WZStringProperty) { type = 3; // String (4) } else if (node is WZPointProperty) { type = 4; // (0) } else if (node is WZCanvasProperty) { type = 5; // (4) } else if (node is WZAudioProperty) { type = 6; // (4) } else { throw new InvalidOperationException("Unhandled WZ node type [1]"); } bw.Write(type); if (node is WZInt32Property) { bw.Write((long)((WZInt32Property)node).Value); } else if (node is WZUInt16Property) { bw.Write((long)((WZUInt16Property)node).Value); } else if (node is WZInt64Property) { bw.Write(((WZInt64Property)node).Value); } else if (node is WZSingleProperty) { bw.Write((double)((WZSingleProperty)node).Value); } else if (node is WZDoubleProperty) { bw.Write(((WZDoubleProperty)node).Value); } else if (node is WZStringProperty) { bw.Write(ds.AddString(((WZStringProperty)node).Value)); } else if (node is WZPointProperty) { Point pNode = ((WZPointProperty)node).Value; bw.Write(pNode.X); bw.Write(pNode.Y); } else if (node is WZCanvasProperty) { WZCanvasProperty wzcp = (WZCanvasProperty)node; bw.Write(ds.AddCanvas(wzcp)); if (dumpImg) { bw.Write((ushort)wzcp.Value.Width); bw.Write((ushort)wzcp.Value.Height); wzcp.Dispose(); } else { bw.Write(0); } } else if (node is WZAudioProperty) { WZAudioProperty wzmp = (WZAudioProperty)node; bw.Write(ds.AddMP3(wzmp)); if (dumpSnd) { bw.Write((uint)wzmp.Value.Length); wzmp.Dispose(); } else { bw.Write(0); } } switch (type) { case 0: bw.Write(0L); break; case 3: bw.Write(0); break; } }