public static global::haxe.io.Bytes createPacket(uint mainID, uint sID, int userID, global::haxe.io.Bytes data, object compress) { unchecked { #line 295 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" bool compress1 = (((compress == default(object))) ? (false) : (global::haxe.lang.Runtime.toBool(compress))); if ((data == null)) { #line 297 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" data = global::org.msgpack.MsgPack.encode(0); } #line 299 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" int len = data.length; int code = (((compress1 == true)) ? (1) : (0)); #line 301 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" object _head = new global::haxe.lang.DynamicObject(new int[] {}, new object[] {}, new int[] { 197623819, 363100693, 1042491189, 1386805980, 1655151068 }, new double[] { ((double)(((uint)(len)))), ((double)(((uint)(code)))), ((double)(sID)), ((double)(((uint)(119)))), ((double)(mainID)) }); #line 309 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" object pk = new global::haxe.lang.DynamicObject(new int[] { 1106197222, 1113806378, 1158359328 }, new object[] { ((object)(userID)), data, _head }, new int[] {}, new double[] {}); #line 312 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" global::haxe.io.Bytes hb = global::org.msgpack.MsgPack.encode(pk); #line 333 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" global::haxe.io.BytesOutput output = new global::haxe.io.BytesOutput(); #line 335 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" output.writeByte(90); output.writeByte(72); #line 337 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" output.writeByte(89); output.writeByte(1); #line 339 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" output.writeByte(0); output.writeByte(0); #line 343 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" output.writeInt32(hb.length); #line 346 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" output.write(hb); #line 348 "D:\\project\\sangong\\sangong\\src\\web\\proto\\PacketBuilder.hx" return(output.getBytes()); } #line default }
public virtual void write(global::haxe.ds.List <object> png) { unchecked { { int _g = 0; global::haxe.root.Array <int> _g1 = new global::haxe.root.Array <int>(new int[] { 137, 80, 78, 71, 13, 10, 26, 10 }); while ((_g < _g1.length)) { int b = _g1[_g]; ++_g; this.o.writeByte(b); } } { global::haxe.ds._List.ListNode <object> _g_head = png.h; while ((_g_head != null)) { global::format.png.Chunk val = ((global::format.png.Chunk)(_g_head.item)); _g_head = _g_head.next; global::format.png.Chunk c = ((global::format.png.Chunk)(val)); switch (c._hx_index) { case 0: { this.writeChunk("IEND", global::haxe.io.Bytes.alloc(0)); break; } case 1: { object h = (c as global::format.png.Chunk_CHeader).h; { global::haxe.io.BytesOutput b1 = new global::haxe.io.BytesOutput(); b1.set_bigEndian(true); b1.writeInt32(((int)(global::haxe.lang.Runtime.getField_f(h, "width", 1247983110, true)))); b1.writeInt32(((int)(global::haxe.lang.Runtime.getField_f(h, "height", 38537191, true)))); b1.writeByte(((int)(global::haxe.lang.Runtime.getField_f(h, "colbits", 1724357446, true)))); global::format.png.Color _g2 = ((global::format.png.Color)(global::haxe.lang.Runtime.getField(h, "color", 1247572323, true))); int tmp = default(int); switch (_g2._hx_index) { case 0: { bool alpha = (_g2 as global::format.png.Color_ColGrey).alpha; tmp = ((alpha) ? (4) : (0)); break; } case 1: { bool alpha1 = (_g2 as global::format.png.Color_ColTrue).alpha; tmp = ((alpha1) ? (6) : (2)); break; } case 2: { tmp = 3; break; } } b1.writeByte(tmp); b1.writeByte(0); b1.writeByte(0); b1.writeByte(((global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.getField(h, "interlaced", 1501088657, true))) ? (1) : (0))); this.writeChunk("IHDR", b1.getBytes()); } break; } case 2: { global::haxe.io.Bytes d = (c as global::format.png.Chunk_CData).b; this.writeChunk("IDAT", d); break; } case 3: { global::haxe.io.Bytes b2 = (c as global::format.png.Chunk_CPalette).b; this.writeChunk("PLTE", b2); break; } case 4: { global::haxe.io.Bytes data = (c as global::format.png.Chunk_CUnknown).data; string id = (c as global::format.png.Chunk_CUnknown).id; this.writeChunk(id, data); break; } } } } } }