public void CompressLzmaTest() { var source = new byte[] { 0x46, 0x57, 0x53, 0x14, 0x5A, 0xB3, 0xB2, 0x00, 0x78, 0x00, 0x07, 0xD0, 0x00, 0x00, 0x18, 0x38, 0x00, 0x00, 0x3C, 0x01, 0x00, 0x44, 0x11, 0x19, 0x00, 0x00, 0x00, 0x7F, 0x13, 0x80, 0x02, 0x00 }; var target = new MemoryStream(); SwfFile.Compress(new MemoryStream(source), target, SwfFormat.ZWS); var res = target.ToArray(); Assert.AreEqual(0x4C, res[8]); Assert.AreEqual(0x5A, res[9]); Assert.AreEqual(0x49, res[10]); Assert.AreEqual(0x50, res[11]); Assert.AreEqual(0x5D, res[12]); Assert.AreEqual(0x00, res[13]); Assert.AreEqual(0x00, res[14]); Assert.AreEqual(0x20, res[15]); Assert.AreEqual(0x00, res[16]); Assert.AreEqual(0x00, res[17]); }
public void CompressZlibTest() { var source = new byte[] { 0x46, 0x57, 0x53, 0x09, 0x20, 0x00, 0x00, 0x00, 0x78, 0x00, 0x07, 0x08, 0x00, 0x00, 0x11, 0xf8, 0x00, 0x00, 0x14, 0x01, 0x00, 0x44, 0x11, 0x08, 0x00, 0x00, 0x00, 0x43, 0x02, 0xff, 0x00, 0x00 }; var target = new MemoryStream(); SwfFile.Compress(new MemoryStream(source), target, SwfFormat.CWS); var res = target.ToArray(); Assert.AreEqual(0x09, res[3]); Assert.AreEqual(0x20, res[4]); Assert.AreEqual(0x00, res[5]); Assert.AreEqual(0x00, res[6]); Assert.AreEqual(0x00, res[7]); }
/// <summary> /// Compresses the specified source. /// </summary> /// <param name="source">The source.</param> /// <param name="target">The target.</param> public void Compress(Stream source, Stream target, SwfFormat format) { SwfFile.Compress(source, target, format); }