func init // adds using namespace sys.add_use('System.IO') // initialize instance if(linked("ByteArray") and linked("doReadAllBytes")) sys.add_var(this.name, 'byte[]') end if(linked("onError")) this.setfield('ex', 'ex' + this.id) end end func doReadAllBytes(data) linked("onError") ? blk.println('try {').inc() : '' if(linked("ByteArray")) blk.println(this.codename, ' = ', this.make_read(data), ';') event("onReadAllBytes", this.codename) else event("onReadAllBytes", this.make_read(data)) end if(linked("onError")) blk.dec().println('} catch (Exception ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func doWriteAllBytes(data) linked("onError") ? blk.println('try {').inc() : '' blk.println('File.WriteAllBytes(', d("Path"), ', ', d("BytesArray"), ');') if(linked("onError")) blk.dec().println('} catch (Exception ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func ByteArray if(linked("doReadAllBytes")) return(this.codename) else return(this.make_read()) end end func make_read(data) return('File.ReadAllBytes(' + d('Path') + ')') end