Example #1
0
        public override object __hx_setField(string field, int hash, object @value, bool handleProperties)
        {
            unchecked {
                switch (hash)
                {
                case 1224789183:
                {
                    this.buffer_size_ = ((int)(global::haxe.lang.Runtime.toInt(@value)));
                    return(@value);
                }


                case 831562591:
                {
                    this.buffer_ = ((uint[])(@value));
                    return(@value);
                }


                case 22841:
                {
                    this.f_ = ((global::sys.io.FileInput)(@value));
                    return(@value);
                }


                default:
                {
                    return(base.__hx_setField(field, hash, @value, handleProperties));
                }
                }
            }
        }
Example #2
0
 public static void __hx_ctor_sys_io_FileInput(global::sys.io.FileInput __temp_me298, global::System.IO.FileStream stream)
 {
     unchecked
     {
         global::cs.io.NativeInput.__hx_ctor_cs_io_NativeInput(__temp_me298, stream);
     }
 }
Example #3
0
 public static global::haxe.io.Bytes getBytes(string path)
 {
     global::sys.io.FileInput f   = global::sys.io.File.read(path, new global::haxe.lang.Null <bool>(true, true));
     global::haxe.io.Bytes    ret = f.readAll(default(global::haxe.lang.Null <int>));
     f.close();
     return(ret);
 }
Example #4
0
 public static global::decode.streams.BrotliInput BrotliFileInput(global::sys.io.FileInput f)
 {
     global::decode.streams.BrotliInput input = new global::decode.streams.BrotliInput();
     input.cb_   = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::decode.Streams), "BrotliFileInputFunction", 675059700)));
     input.data_ = f;
     return(input);
 }
Example #5
0
        public static string getContent(string path)
        {
            global::sys.io.FileInput f = global::sys.io.File.read(path, new global::haxe.lang.Null <bool>(false, true));
            string ret = f.readAll(default(global::haxe.lang.Null <int>)).toString();

            f.close();
            return(ret);
        }
Example #6
0
        public static int BrotliFileInputFunction(global::sys.io.FileInput data, uint[] buf, int buf_off, int count)
        {
            global::haxe.io.Bytes bytes = global::haxe.io.Bytes.alloc(count);
            int size = data.readBytes(bytes, 0, count);

            {
                int _g1 = 0;
                while ((_g1 < size))
                {
                    int i = _g1++;
                    ((uint[])(buf))[(buf_off + i)] = ((uint)(((int)(bytes.b[i]))));
                }
            }

            return(size);
        }
Example #7
0
 protected static void __hx_ctor_sys_io_FileInput(global::sys.io.FileInput __hx_this, global::System.IO.FileStream stream)
 {
     global::cs.io.NativeInput.__hx_ctor_cs_io_NativeInput(__hx_this, stream);
 }
Example #8
0
    public static void main()
    {
        unchecked {
            global::Array <object> argv        = global::Sys.args();
            global::Array <object> input_path  = new global::Array <object>(new object[] { "" });
            global::Array <object> output_path = new global::Array <object>(new object[] { "" });
            global::Array <int>    force       = new global::Array <int>(new int[] { 0 });
            global::Array <int>    quality     = new global::Array <int>(new int[] { 11 });
            global::Array <int>    decompress  = new global::Array <int>(new int[] { 0 });
            if (!(global::Main.ParseArgv(argv.length, argv, input_path, output_path, force, quality, decompress)))
            {
                return;
            }

            if (!(global::sys.FileSystem.exists(global::haxe.lang.Runtime.toString(input_path[0]))))
            {
                global::System.Console.Write(((object)("Input Filename doesn\'t exists")));
                return;
            }

            if ((global::sys.FileSystem.exists(global::haxe.lang.Runtime.toString(output_path[0])) && (force[0] == 0)))
            {
                global::System.Console.Write(((object)("Output Filename can\'t overwrite")));
                return;
            }

            uint[]                    dictionary  = global::Brotli.OpenInputBinary("dictionary.txt");
            global::Date              _this       = new global::Date(((global::System.DateTime)(global::System.DateTime.Now)));
            double                    clock_start = (((double)(((long)((((long)(global::System.TimeZone.CurrentTimeZone.ToUniversalTime(((global::System.DateTime)(_this.date))).Ticks)) - ((long)(global::Date.epochTicks))))))) / ((double)(global::System.TimeSpan.TicksPerMillisecond)));
            global::sys.io.FileInput  fin         = global::Brotli.OpenInputFile(global::haxe.lang.Runtime.toString(input_path[0]));
            global::sys.io.FileOutput fout        = global::Brotli.OpenOutputFile(global::haxe.lang.Runtime.toString(output_path[0]), force[0]);
            if ((decompress[0] > 0))
            {
                global::decode.Dictionary.kBrotliDictionary = dictionary;
                global::Date _this1       = new global::Date(((global::System.DateTime)(global::System.DateTime.Now)));
                long         __temp_expr3 = (((long)(global::System.TimeZone.CurrentTimeZone.ToUniversalTime(((global::System.DateTime)(_this1.date))).Ticks)) - ((long)(global::Date.epochTicks)));
                long         __temp_expr4 = global::System.TimeSpan.TicksPerMillisecond;
                if ((global::decode.Decode.BrotliDecompress(global::decode.Streams.BrotliFileInput(fin), global::decode.Streams.BrotliFileOutput(fout)) <= 0))
                {
                    global::System.Console.Write(((object)("Error while decoding")));
                    return;
                }
            }
            else
            {
                global::encode.Dictionary.kBrotliDictionary = dictionary;
                uint[] DictionaryHash    = global::Brotli.OpenInputBinary("DictionaryHash.txt");
                uint[] DictionaryWords   = global::Brotli.OpenInputBinary("DictionaryWords.txt");
                uint[] DictionaryBuckets = global::Brotli.OpenInputBinary("DictionaryBuckets.txt");
                global::Array <uint> kStaticDictionaryHash    = global::encode.Dictionary_hash.kStaticDictionaryHash;
                global::Array <uint> kStaticDictionaryBuckets = global::encode.Static_dict_lut.kStaticDictionaryBuckets;
                {
                    int _g = 0;
                    while ((_g < 32768))
                    {
                        int i = _g++;
                        kStaticDictionaryHash.push(((uint)((((uint)((((uint)(((uint[])(DictionaryHash))[((i * 2) + 1)])) << 8))) | ((uint)(((uint[])(DictionaryHash))[(i * 2)]))))));
                        kStaticDictionaryBuckets.push(((uint)((((uint)((((uint)((((uint)(((uint[])(DictionaryBuckets))[((i * 3) + 2)])) << 16))) | ((uint)((((uint)(((uint[])(DictionaryBuckets))[((i * 3) + 1)])) << 8)))))) | ((uint)(((uint[])(DictionaryBuckets))[(i * 3)]))))));
                    }
                }

                global::Array <object> kStaticDictionaryWords = global::encode.Static_dict_lut.kStaticDictionaryWords;
                {
                    int _g1 = 0;
                    while ((_g1 < 31704))
                    {
                        int i1 = _g1++;
                        kStaticDictionaryWords.push(new global::encode.static_dict_lut.DictWord(((uint)(((uint)((((uint)(((uint)(((uint[])(DictionaryWords))[((i1 * 3) + 1)])))) >> 3))))), ((uint)(((uint[])(DictionaryWords))[((i1 * 3) + 2)])), ((uint)((((uint)(((((uint)((((uint)(((uint[])(DictionaryWords))[((i1 * 3) + 1)])) & 7)))) << 8))) | ((uint)(((uint[])(DictionaryWords))[(i1 * 3)])))))));
                    }
                }

                global::encode.encode.BrotliParams @params = new global::encode.encode.BrotliParams();
                @params.quality = quality[0];
                global::Date _this2       = new global::Date(((global::System.DateTime)(global::System.DateTime.Now)));
                long         __temp_expr1 = (((long)(global::System.TimeZone.CurrentTimeZone.ToUniversalTime(((global::System.DateTime)(_this2.date))).Ticks)) - ((long)(global::Date.epochTicks)));
                long         __temp_expr2 = global::System.TimeSpan.TicksPerMillisecond;
                if (!(global::encode.Encode.BrotliCompress(@params, new global::encode.streams.BrotliIn(fin, 65536), new global::encode.streams.BrotliOut(((global::sys.io.FileOutput)(fout))))))
                {
                    global::System.Console.Write(((object)("Error while encoding")));
                    return;
                }
            }

            global::Date _this3   = new global::Date(((global::System.DateTime)(global::System.DateTime.Now)));
            double       duration = ((((((double)(((long)((((long)(global::System.TimeZone.CurrentTimeZone.ToUniversalTime(((global::System.DateTime)(_this3.date))).Ticks)) - ((long)(global::Date.epochTicks))))))) / ((double)(global::System.TimeSpan.TicksPerMillisecond))) - clock_start)) / 1000);
            if ((duration < 1e-9))
            {
                duration = 1e-9;
            }

            if ((decompress[0] > 0))
            {
                fout.tell();
            }
            else
            {
                fin.tell();
            }

            return;
        }
    }
Example #9
0
 public BrotliIn(global::sys.io.FileInput f, int max_read_size)
 {
     global::encode.streams.BrotliIn.__hx_ctor_encode_streams_BrotliIn(this, f, max_read_size);
 }
Example #10
0
 public static void __hx_ctor_encode_streams_BrotliIn(global::encode.streams.BrotliIn __hx_this, global::sys.io.FileInput f, int max_read_size)
 {
     __hx_this.f_           = f;
     __hx_this.buffer_      = global::FunctionMalloc.mallocUInt(max_read_size);
     __hx_this.buffer_size_ = max_read_size;
 }