public static global::decode.streams.BrotliOutput BrotliFileOutput(global::sys.io.FileOutput f) { global::decode.streams.BrotliOutput @out = new global::decode.streams.BrotliOutput(); @out.cb_ = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::decode.Streams), "BrotliFileOutputFunction", 1973282887))); @out.data_ = f; return(@out); }
public static void main() { unchecked { global::haxe.io.Bytes io = global::sys.io.File.getBytes("jump_fall.gif"); global::ugiflib.UGifFile file = global::ugiflib.UGifLib.read(io); global::haxe.Log.trace.__hx_invoke2_o(((double)(file.width)), global::haxe.lang.Runtime.undefined, default(double), new global::haxe.lang.DynamicObject(new int[] { 302979532, 1547539107, 1648581351, 1830310359 }, new object[] { "main", "ugiflib.Test", "Test.hx", new global::haxe.root.Array <object>(new object[] { file.height, file.frames }) }, new int[] { 1981972957 }, new double[] { ((double)(9)) })); global::sys.io.FileOutput @out = global::sys.io.File.write("jump_fall.edit.gif", default(global::haxe.lang.Null <bool>)); new global::format.png.Writer(((global::haxe.io.Output)(@out))).write(global::format.png.Tools.build32BGRA((file.width * (file.frames as global::System.Array).Length), file.height, file.picture, default(global::haxe.lang.Null <int>))); @out.close(); } }
public static int BrotliFileOutputFunction(global::sys.io.FileOutput data, uint[] buf, int buf_off, int count) { global::haxe.io.Bytes bytes = global::haxe.io.Bytes.alloc(count); { int _g1 = 0; while ((_g1 < count)) { int i = _g1++; bytes.b[i] = ((byte)(((uint)(((uint[])(buf))[i])))); } } data.write(bytes); return(bytes.length); }
public override object __hx_setField(string field, int hash, object @value, bool handleProperties) { unchecked { switch (hash) { case 22841: { this.f_ = ((global::sys.io.FileOutput)(@value)); return(@value); } default: { return(base.__hx_setField(field, hash, @value, handleProperties)); } } } }
protected static void __hx_ctor_sys_io_FileOutput(global::sys.io.FileOutput __hx_this, global::System.IO.FileStream stream) { global::cs.io.NativeOutput.__hx_ctor_cs_io_NativeOutput(__hx_this, stream); }
public BrotliOut(global::sys.io.FileOutput f) { global::encode.streams.BrotliOut.__hx_ctor_encode_streams_BrotliOut(this, f); }
public static void __hx_ctor_encode_streams_BrotliOut(global::encode.streams.BrotliOut __hx_this, global::sys.io.FileOutput f) { __hx_this.f_ = f; }
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; } }
public static void saveBytes(string path, global::haxe.io.Bytes bytes) { global::sys.io.FileOutput f = global::sys.io.File.write(path, new global::haxe.lang.Null <bool>(true, true)); f.writeBytes(bytes, 0, bytes.length); f.close(); }
public static void saveContent(string path, string content) { global::sys.io.FileOutput f = global::sys.io.File.write(path, new global::haxe.lang.Null <bool>(false, true)); f.writeString(content); f.close(); }