func init // adds using namespace sys.add_use('System.IO') // initialize instance params = this.props('Constructor').value if(params == 'None') sys.add_var(this.name, 'BinaryReader') else if(params == 'Constructor') params = '' + d("Stream") elseif(params == 'Constructor2') params = '' + d("Stream") + ', ' + (isdef("Encoding") ? d("encoding") : sys.get_undef_manager("Encoding")) end sys.add_object(this.codename, 'BinaryReader', params) end // makes implementation methods for properties sys._prop_init('BaseStream', 1, 0, 0) // makes implementation of methods as properties sys._mtd_as_prop_init('PeekChar()') sys._mtd_as_prop_init('Read()') sys._mtd_as_prop_init('ReadBoolean()') sys._mtd_as_prop_init('ReadByte()') sys._mtd_as_prop_init('ReadChar()') sys._mtd_as_prop_init('ReadDecimal()') sys._mtd_as_prop_init('ReadDouble()') sys._mtd_as_prop_init('ReadInt16()') sys._mtd_as_prop_init('ReadInt32()') sys._mtd_as_prop_init('ReadInt64()') sys._mtd_as_prop_init('ReadSByte()') sys._mtd_as_prop_init('ReadSingle()') sys._mtd_as_prop_init('ReadString()') sys._mtd_as_prop_init('ReadUInt16()') sys._mtd_as_prop_init('ReadUInt32()') sys._mtd_as_prop_init('ReadUInt64()') sys._mtd_as_prop_init('BinaryReader') // makes implementation of simple methods sys._method_init('Close') sys._method_init('Dispose') if(linked("onError")) this.setfield('ex', 'ex' + this.id) end end func doConstructor(data) linked("onError") ? blk.println('try {').inc() : '' blk.println(this.codename, ' = new BinaryReader(', d("Stream"), ');') if(linked("onError")) blk.dec().println('} catch (Exception ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func doConstructor2(data) linked("onError") ? blk.println('try {').inc() : '' blk.println(this.codename, ' = new BinaryReader(', d("Stream"), ', ', isdef("Encoding") ? d("encoding") : sys.get_undef_manager("Encoding"), ');') if(linked("onError")) blk.dec().println('} catch (Exception ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func doRead2(data) linked("onError") ? blk.println('try {').inc() : '' if(linked("onRead")) event("onRead", this.codename + '.Read(' + d("buffer") + ', ' + d("index") + ', ' + d("count") + ')') else blk.println(this.codename, '.Read(', d("buffer"), ', ', d("index"), ', ', d("count"), ');') end if(linked("onError")) blk.dec().println('} catch (Exception ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func doRead3(data) linked("onError") ? blk.println('try {').inc() : '' if(linked("onRead")) event("onRead", this.codename + '.Read(' + d("buffer") + ', ' + d("index") + ', ' + d("count") + ')') else blk.println(this.codename, '.Read(', d("buffer"), ', ', d("index"), ', ', d("count"), ');') end if(linked("onError")) blk.dec().println('} catch (Exception ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func doReadBytes(data) linked("onError") ? blk.println('try {').inc() : '' if(linked("onReadBytes")) event("onReadBytes", this.codename + '.ReadBytes(' + d("count") + ')') else blk.println(this.codename, '.ReadBytes(', d("count"), ');') end if(linked("onError")) blk.dec().println('} catch (Exception ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end func doReadChars(data) linked("onError") ? blk.println('try {').inc() : '' if(linked("onReadChars")) event("onReadChars", this.codename + '.ReadChars(' + d("count") + ')') else blk.println(this.codename, '.ReadChars(', d("count"), ');') end if(linked("onError")) blk.dec().println('} catch (Exception ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end