コード例 #1
0
        public override void WriteValue(WzBinaryWriter writer)
        {
            writer.WriteStringValue("Canvas", 0x73, 0x1B);
            writer.Write((byte)0);
            if (WzProperties.Count > 0)
            {
                writer.Write((byte)1);
                WritePropertyList(writer, WzProperties);
            }
            else
            {
                writer.Write((byte)0);
            }

            writer.WriteCompressedInt(PngProperty.Width);
            writer.WriteCompressedInt(PngProperty.Height);
            writer.WriteCompressedInt(PngProperty.Format1);
            writer.Write((byte)PngProperty.Format2);
            writer.Write(0);
            var bytes = PngProperty.GetCompressedBytes(false);

            writer.Write(bytes.Length + 1);
            writer.Write((byte)0);
            writer.Write(bytes);
        }
コード例 #2
0
 internal void SaveDirectory(WzBinaryWriter writer)
 {
     offset = (uint)writer.BaseStream.Position;
     int entryCount = subDirs.Count + images.Count;
     if (entryCount == 0)
     {
         BlockSize = 0;
         return;
     }
     writer.WriteCompressedInt(entryCount);
     foreach (WzImage img in images)
     {
         writer.WriteWzObjectValue(img.name, 4);
         writer.WriteCompressedInt(img.BlockSize);
         writer.WriteCompressedInt(img.Checksum);
         writer.WriteOffset(img.Offset);
     }
     foreach (WzDirectory dir in subDirs)
     {
         writer.WriteWzObjectValue(dir.name, 3);
         writer.WriteCompressedInt(dir.BlockSize);
         writer.WriteCompressedInt(dir.Checksum);
         writer.WriteOffset(dir.Offset);
     }
     foreach (WzDirectory dir in subDirs)
         if (dir.BlockSize > 0)
             dir.SaveDirectory(writer);
         else
             writer.Write((byte)0);
 }
コード例 #3
0
        public override void WriteValue(WzBinaryWriter writer)
        {
            writer.WriteStringValue("Canvas", WzImage.WzImageHeaderByte_WithoutOffset, WzImage.WzImageHeaderByte_WithOffset);
            writer.Write((byte)0);
            if (properties.Count > 0) // subproperty in the canvas
            {
                writer.Write((byte)1);
                WzImageProperty.WritePropertyList(writer, properties);
            }
            else
            {
                writer.Write((byte)0);
            }

            // Image info
            writer.WriteCompressedInt(PngProperty.Width);
            writer.WriteCompressedInt(PngProperty.Height);
            writer.WriteCompressedInt(PngProperty.Format);
            writer.Write((byte)PngProperty.Format2);
            writer.Write((Int32)0);

            // Write image
            byte[] bytes = PngProperty.GetCompressedBytes(false);
            writer.Write(bytes.Length + 1);
            writer.Write((byte)0); // header? see WzImageProperty.ParseExtendedProp "0x00"
            writer.Write(bytes);
        }
コード例 #4
0
 public override void WriteValue(WzBinaryWriter writer)
 {
     writer.WriteStringValue("Sound_DX8", 0x73, 0x1B);
     writer.Write((byte)0);
     writer.WriteCompressedInt(SoundData.Length);
     writer.WriteCompressedInt(0);
     writer.Write(SoundData);
 }
コード例 #5
0
 public override void WriteValue(WzBinaryWriter pWriter)
 {
     byte[] data = GetBytes();
     pWriter.WriteStringValue("Sound_DX8", 0x73, 0x1B);
     pWriter.Write((byte)0);
     pWriter.WriteCompressedInt(data.Length);
     pWriter.WriteCompressedInt(0);
     pWriter.Write(data);
 }
コード例 #6
0
 public override void WriteValue(WzBinaryWriter writer)
 {
     byte[] data = GetBytes(false);
     writer.WriteStringValue("Sound_DX8", WzImage.WzImageHeaderByte_WithoutOffset, WzImage.WzImageHeaderByte_WithOffset);
     writer.Write((byte)0);
     writer.WriteCompressedInt(data.Length);
     writer.WriteCompressedInt(len_ms);
     writer.Write(header);
     writer.Write(data);
 }
コード例 #7
0
 public override void WriteValue(WzBinaryWriter writer)
 {
     byte[] data = GetBytes(false);
     writer.WriteStringValue("Sound_DX8", 0x73, 0x1B);
     writer.Write((byte)0);
     writer.WriteCompressedInt(data.Length);
     writer.WriteCompressedInt(len_ms);
     writer.Write(header);
     writer.Write(data);
 }
コード例 #8
0
        internal static void WritePropertyList(WzBinaryWriter writer, List <WzImageProperty> properties)
        {
            if (properties.Count == 1 && properties[0] is WzLuaProperty)
            {
                properties[0].WriteValue(writer);
            }
            else
            {
                writer.WriteStringValue("Property", 0x73, 0x1B);

                writer.Write((ushort)0);
                writer.WriteCompressedInt(properties.Count);
                for (int i = 0; i < properties.Count; i++)
                {
                    writer.WriteStringValue(properties[i].Name, 0x00, 0x01);
                    if (properties[i] is WzExtended)
                    {
                        WriteExtendedValue(writer, (WzExtended)properties[i]);
                    }
                    else
                    {
                        properties[i].WriteValue(writer);
                    }
                }
            }
        }
コード例 #9
0
        public override void WriteValue(WzBinaryWriter writer)
        {
            var extendedProps = _properties.Where(x => x is WzExtended).ToList();

            writer.WriteStringValue("Shape2D#Convex2D", 0x73, 0x1B);
            writer.WriteCompressedInt(extendedProps.Count);
            extendedProps.ForEach(x => x.WriteValue(writer));
        }
コード例 #10
0
 public override void WriteValue(WzBinaryWriter pWriter)
 {
     pWriter.WriteStringValue("Shape2D#Convex2D", 0x73, 0x1B);
     pWriter.WriteCompressedInt(mProperties.Count);
     foreach (AWzImageProperty prop in mProperties)
     {
         prop.WriteValue(pWriter);
     }
 }
コード例 #11
0
 internal static void WritePropertyList(WzBinaryWriter writer, IWzImageProperty[] properties)
 {
     writer.Write((ushort)0);
     writer.WriteCompressedInt(properties.Length);
     for (int i = 0; i < properties.Length; i++)
     {
         writer.WriteStringValue(properties[i].Name, 0x00, 0x01);
         properties[i].WriteValue(writer);
     }
 }
コード例 #12
0
        internal void SaveDirectory(WzBinaryWriter writer)
        {
            Offset = (uint)writer.BaseStream.Position;
            var entryCount = WzDirectories.Count + WzImages.Count;

            if (entryCount == 0)
            {
                BlockSize = 0;
                return;
            }

            writer.WriteCompressedInt(entryCount);
            foreach (var img in WzImages)
            {
                writer.WriteWzObjectValue(img.Name, 4);
                writer.WriteCompressedInt(img.BlockSize);
                writer.WriteCompressedInt(img.Checksum);
                writer.WriteOffset(img.Offset);
            }

            foreach (var dir in WzDirectories)
            {
                writer.WriteWzObjectValue(dir.Name, 3);
                writer.WriteCompressedInt(dir.BlockSize);
                writer.WriteCompressedInt(dir.Checksum);
                writer.WriteOffset(dir.Offset);
            }

            foreach (var dir in WzDirectories)
            {
                if (dir.BlockSize > 0)
                {
                    dir.SaveDirectory(writer);
                }
                else
                {
                    writer.Write((byte)0);
                }
            }
        }
コード例 #13
0
ファイル: WzCanvasProperty.cs プロジェクト: odasm/MapleLib
 /// <summary>
 /// Gets a wz property by it's name
 /// </summary>
 /// <param name="pWriter">The name of the property</param>
 /// <returns>The wz property with the specified name</returns>
 public override void WriteValue(WzBinaryWriter pWriter)
 {
     pWriter.WriteStringValue("Canvas", 0x73, 0x1B);
     pWriter.Write((byte)0);
     if (mProperties.Count > 0)
     {
         pWriter.Write((byte)1);
         WritePropertyList(pWriter, mProperties);
     }
     else
     {
         pWriter.Write((byte)0);
     }
     pWriter.WriteCompressedInt(PngProperty.Width);
     pWriter.WriteCompressedInt(PngProperty.Height);
     pWriter.WriteCompressedInt(PngProperty.mFormat);
     pWriter.Write((byte)PngProperty.mFormat2);
     pWriter.Write(0);
     byte[] bytes = PngProperty.GetCompressedBytes();
     pWriter.Write(bytes.Length + 1);
     pWriter.Write((byte)0);
     pWriter.Write(bytes);
 }
コード例 #14
0
        internal void SaveDirectory(WzBinaryWriter pWriter)
        {
            mOffset = (uint)pWriter.BaseStream.Position;
            int entryCount = mSubDirs.Count + mImages.Count;

            if (entryCount == 0)
            {
                BlockSize = 0;
                return;
            }
            pWriter.WriteCompressedInt(entryCount);
            foreach (WzImage img in mImages)
            {
                pWriter.WriteWzObjectValue(img.mName, 4);
                pWriter.WriteCompressedInt(img.BlockSize);
                pWriter.WriteCompressedInt(img.Checksum);
                pWriter.WriteOffset(img.Offset);
            }
            foreach (WzDirectory dir in mSubDirs)
            {
                pWriter.WriteWzObjectValue(dir.mName, 3);
                pWriter.WriteCompressedInt(dir.BlockSize);
                pWriter.WriteCompressedInt(dir.Checksum);
                pWriter.WriteOffset(dir.Offset);
            }
            foreach (WzDirectory dir in mSubDirs)
            {
                if (dir.BlockSize > 0)
                {
                    dir.SaveDirectory(pWriter);
                }
                else
                {
                    pWriter.Write((byte)0);
                }
            }
        }
コード例 #15
0
 internal static void WritePropertyList(WzBinaryWriter writer, List <IWzImageProperty> properties)
 {
     writer.Write((ushort)0);
     writer.WriteCompressedInt(properties.Count);
     for (int i = 0; i < properties.Count; i++)
     {
         writer.WriteStringValue(properties[i].Name, 0x00, 0x01);
         if (properties[i] is IExtended)
         {
             WriteExtendedValue(writer, (IExtended)properties[i]);
         }
         else
         {
             properties[i].WriteValue(writer);
         }
     }
 }
コード例 #16
0
 internal static void WritePropertyList(WzBinaryWriter pWriter, List <AWzImageProperty> pProperties)
 {
     pWriter.Write((ushort)0);
     pWriter.WriteCompressedInt(pProperties.Count);
     foreach (AWzImageProperty prop in pProperties)
     {
         pWriter.WriteStringValue(prop.Name, 0x00, 0x01);
         if (prop is IExtended)
         {
             WriteExtendedProperty(pWriter, prop);
         }
         else
         {
             prop.WriteValue(pWriter);
         }
     }
 }
コード例 #17
0
        public override void WriteValue(WzBinaryWriter writer)
        {
            List <WzExtended> extendedProps = new List <WzExtended>(properties.Count);

            foreach (WzImageProperty prop in properties)
            {
                if (prop is WzExtended)
                {
                    extendedProps.Add((WzExtended)prop);
                }
            }
            writer.WriteStringValue("Shape2D#Convex2D", WzImage.WzImageHeaderByte_WithoutOffset, WzImage.WzImageHeaderByte_WithOffset);
            writer.WriteCompressedInt(extendedProps.Count);

            foreach (WzImageProperty imgProperty in properties)
            {
                imgProperty.WriteValue(writer);
            }
        }
コード例 #18
0
 internal static void WritePropertyList(WzBinaryWriter writer, List <WzImageProperty> properties)
 {
     if (properties.Count == 1 && properties[0] is WzLuaProperty)
     {
         properties[0].WriteValue(writer);
     }
     else
     {
         writer.Write((ushort)0);
         writer.WriteCompressedInt(properties.Count);
         foreach (WzImageProperty imgProperty in properties)
         {
             writer.WriteStringValue(imgProperty.Name, 0x00, 0x01);
             if (imgProperty is WzExtended extended)
             {
                 WriteExtendedValue(writer, extended);
             }
             else
             {
                 imgProperty.WriteValue(writer);
             }
         }
     }
 }
コード例 #19
0
 public override void WriteValue(WzBinaryWriter writer)
 {
     writer.WriteStringValue("Shape2D#Vector2D", WzImage.WzImageHeaderByte_WithoutOffset, WzImage.WzImageHeaderByte_WithOffset);
     writer.WriteCompressedInt(X.Value);
     writer.WriteCompressedInt(Y.Value);
 }
コード例 #20
0
 public override void WriteValue(WzBinaryWriter writer)
 {
     writer.WriteStringValue("Shape2D#Vector2D", 0x73, 0x1B);
     writer.WriteCompressedInt(X.Value);
     writer.WriteCompressedInt(Y.Value);
 }
コード例 #21
0
ファイル: WzIntProperty.cs プロジェクト: razfriman/MapleLib
 public override void WriteValue(WzBinaryWriter writer)
 {
     writer.Write((byte)3);
     writer.WriteCompressedInt(Value);
 }