Beispiel #1
0
        public virtual global::format.gif.Block readApplicationExtension()
        {
            unchecked {
                if ((this.i.readByte() != 11))
                {
                    throw global::haxe.lang.HaxeException.wrap("Incorrect size of Application Extension introducer block.");
                }

                string name    = this.i.readString(8);
                string version = this.i.readString(3);
                global::haxe.io.BytesOutput buffer = new global::haxe.io.BytesOutput();
                global::haxe.io.Bytes       bytes  = global::haxe.io.Bytes.alloc(255);
                int len = this.i.readByte();
                while ((len != 0))
                {
                    this.i.readBytes(bytes, 0, len);
                    buffer.writeBytes(bytes, 0, len);
                    len = this.i.readByte();
                }

                buffer.flush();
                bytes = buffer.getBytes();
                buffer.close();
                global::haxe.io.Bytes data = bytes;
                if ((((name == "NETSCAPE") && (version == "2.0")) && (((int)(data.b[0])) == 1)))
                {
                    return(global::format.gif.Block.BExtension(global::format.gif.Extension.EApplicationExtension(global::format.gif.ApplicationExtension.AENetscapeLooping((((int)(data.b[1])) | (((int)(data.b[2])) << 8))))));
                }

                return(global::format.gif.Block.BExtension(global::format.gif.Extension.EApplicationExtension(global::format.gif.ApplicationExtension.AEUnknown(name, version, data))));
            }
        }
Beispiel #2
0
 public virtual void testUint(uint d)
 {
     unchecked {
                     #line 66 "D:\\project\\sangong\\sangong\\src\\Client.hx"
         global::haxe.io.BytesOutput buf2 = new global::haxe.io.BytesOutput();
                     #line 68 "D:\\project\\sangong\\sangong\\src\\Client.hx"
         global::[email protected](buf2, d);
                     #line 71 "D:\\project\\sangong\\sangong\\src\\Client.hx"
         global::haxe.io.BytesInput i = new global::haxe.io.BytesInput(buf2.getBytes(), null, null);
                     #line 73 "D:\\project\\sangong\\sangong\\src\\Client.hx"
         uint xx = global::[email protected](i);
                     #line 75 "D:\\project\\sangong\\sangong\\src\\Client.hx"
         global::haxe.Log.trace.__hx_invoke2_o(default(double), global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("\u751f\u6210\u7684uint?=", global::haxe.root.Std.@string(xx)), "  t="), global::haxe.root.Std.@string(global::haxe.root.Type.@typeof(xx))), default(double), new global::haxe.lang.DynamicObject(new int[] { 302979532, 1547539107, 1648581351 }, new object[] { "testUint", "Client", "src/Client.hx" }, new int[] { 1981972957 }, new double[] { ((double)(75)) }));
     }
             #line default
 }
Beispiel #3
0
        public global::haxe.io.Bytes readBlocks()
        {
            unchecked {
                global::haxe.io.BytesOutput buffer = new global::haxe.io.BytesOutput();
                global::haxe.io.Bytes       bytes  = global::haxe.io.Bytes.alloc(255);
                int len = this.i.readByte();
                while ((len != 0))
                {
                    this.i.readBytes(bytes, 0, len);
                    buffer.writeBytes(bytes, 0, len);
                    len = this.i.readByte();
                }

                buffer.flush();
                bytes = buffer.getBytes();
                buffer.close();
                return(bytes);
            }
        }
        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
        }
Beispiel #5
0
        public virtual global::format.gif.Block readExtension()
        {
            unchecked {
                int subId = this.i.readByte();
                switch (subId)
                {
                case 1:
                {
                    if ((this.i.readByte() != 12))
                    {
                        throw global::haxe.lang.HaxeException.wrap("Incorrect size of Plain Text Extension introducer block.");
                    }

                    int tmp  = this.i.readUInt16();
                    int tmp1 = this.i.readUInt16();
                    int tmp2 = this.i.readUInt16();
                    int tmp3 = this.i.readUInt16();
                    int tmp4 = this.i.readByte();
                    int tmp5 = this.i.readByte();
                    int tmp6 = this.i.readByte();
                    int tmp7 = this.i.readByte();
                    global::haxe.io.BytesOutput buffer = new global::haxe.io.BytesOutput();
                    global::haxe.io.Bytes       bytes  = global::haxe.io.Bytes.alloc(255);
                    int len = this.i.readByte();
                    while ((len != 0))
                    {
                        this.i.readBytes(bytes, 0, len);
                        buffer.writeBytes(bytes, 0, len);
                        len = this.i.readByte();
                    }

                    buffer.flush();
                    bytes = buffer.getBytes();
                    buffer.close();
                    object __temp_stmt5 = null;
                    {
                        string __temp_odecl1 = bytes.toString();
                        __temp_stmt5 = new global::haxe.lang.DynamicObject(new int[] { 1291439277 }, new object[] { __temp_odecl1 }, new int[] { 31706958, 89406858, 555415130, 853386981, 853386982, 1539378591, 1740766879, 1991808755 }, new double[] { ((double)(tmp4)), ((double)(tmp7)), ((double)(tmp3)), ((double)(tmp)), ((double)(tmp1)), ((double)(tmp5)), ((double)(tmp6)), ((double)(tmp2)) });
                    }

                    global::format.gif.Extension __temp_stmt4 = global::format.gif.Extension.EText(__temp_stmt5);
                    return(global::format.gif.Block.BExtension(__temp_stmt4));
                }


                case 249:
                {
                    if ((this.i.readByte() != 4))
                    {
                        throw global::haxe.lang.HaxeException.wrap("Incorrect Graphic Control Extension block size!");
                    }

                    int packed = this.i.readByte();
                    global::format.gif.DisposalMethod disposalMethod = null;
                    int _g = (((packed & 28)) >> 2);
                    switch (_g)
                    {
                    case 0:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.UNSPECIFIED;
                        break;
                    }


                    case 1:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.NO_ACTION;
                        break;
                    }


                    case 2:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.FILL_BACKGROUND;
                        break;
                    }


                    case 3:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.RENDER_PREVIOUS;
                        break;
                    }


                    default:
                    {
                        disposalMethod = global::format.gif.DisposalMethod.UNDEFINED((((packed & 28)) >> 2));
                        break;
                    }
                    }

                    object __temp_stmt7 = null;
                    {
                        int __temp_odecl2 = this.i.readUInt16();
                        int __temp_odecl3 = this.i.readByte();
                        __temp_stmt7 = new global::haxe.lang.DynamicObject(new int[] { 701242674, 755457067, 1743811007 }, new object[] { disposalMethod, (((packed & 1)) == 1), (((packed & 2)) == 2) }, new int[] { 772773472, 1462163331 }, new double[] { ((double)(__temp_odecl3)), ((double)(__temp_odecl2)) });
                    }

                    global::format.gif.Extension __temp_stmt6 = global::format.gif.Extension.EGraphicControl(__temp_stmt7);
                    global::format.gif.Block     b            = global::format.gif.Block.BExtension(__temp_stmt6);
                    this.i.readByte();
                    return(b);
                }


                case 254:
                {
                    global::haxe.io.BytesOutput buffer1 = new global::haxe.io.BytesOutput();
                    global::haxe.io.Bytes       bytes1  = global::haxe.io.Bytes.alloc(255);
                    int len1 = this.i.readByte();
                    while ((len1 != 0))
                    {
                        this.i.readBytes(bytes1, 0, len1);
                        buffer1.writeBytes(bytes1, 0, len1);
                        len1 = this.i.readByte();
                    }

                    buffer1.flush();
                    bytes1 = buffer1.getBytes();
                    buffer1.close();
                    return(global::format.gif.Block.BExtension(global::format.gif.Extension.EComment(bytes1.toString())));
                }


                case 255:
                {
                    return(this.readApplicationExtension());
                }


                default:
                {
                    global::haxe.io.BytesOutput buffer2 = new global::haxe.io.BytesOutput();
                    global::haxe.io.Bytes       bytes2  = global::haxe.io.Bytes.alloc(255);
                    int len2 = this.i.readByte();
                    while ((len2 != 0))
                    {
                        this.i.readBytes(bytes2, 0, len2);
                        buffer2.writeBytes(bytes2, 0, len2);
                        len2 = this.i.readByte();
                    }

                    buffer2.flush();
                    bytes2 = buffer2.getBytes();
                    buffer2.close();
                    return(global::format.gif.Block.BExtension(global::format.gif.Extension.EUnknown(subId, bytes2)));
                }
                }
            }
        }
Beispiel #6
0
        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;
                        }
                        }
                    }
                }
            }
        }