func init // adds using namespace sys.add_use('System') // initialize instance if(linked("Result")) sys.add_var(this.name, 'dynamic') end // initialize methods this.setfield('fname', fname) sys._do_init('ToBoolean') sys._do_init('ToChar') sys._do_init('ToDouble') sys._do_init('ToShort') sys._do_init('ToInt') sys._do_init('ToLong') sys._do_init('ToSingle') sys._do_init('ToUShort') sys._do_init('ToUInt') sys._do_init('ToULong') end func implement(data, f) this.typecode = this.get_typecode(f) if(linked("Result")) blk.println(this.codename, ' = BitConverter.', code(copy(f, 2)), '(', d("Array"), ', ', d("Index"), ');') event("onResult", sub(this.codename, this.typecode)) else event("onResult", sub('BitConverter.' + code(copy(f, 2)) + '(' + d("Array") + ', ' + d("Index") + ')', this.typecode)) end end func Result return(this.codename) end func IsLittleEndian return('BitConverter.IsLittleEndian') end func get_typecode(f) arr = regex_search(f, 'doTo(\\w+)') if(arr.size()) return(sys.type_code(arr.get(1))) end return(0) end