func init if(linked("StringBuilder")) // add using module sys.add_use('System.Text') // defines an instance of StringBuilder this.setfield('sb', d("StringBuilder")) // initialize properties if(linked("onError")) this.setfield('ex', 'ex' + this.id) end sys.add_var(this.name, 'char[]') blk_init.println(this.codename, ' = new char[', this.props("Size").value, '];') end end func make_copy(data) blk.println(this.sb, '.CopyTo(', d("srcIndex"), ', ', this.codename, ', ', d("dstIndex"), ', ', d("Count"), ');') end func doCopyTo(data) if(linked("StringBuilder")) linked("onError") ? blk.println('try {').inc() : '' this.make_copy(data) event("onResult", this.codename) if(linked("onError")) blk.dec().println('} catch(ArgumentOutOfRangeException ', this.ex, ') {').inc() event("onError", this.ex + '.Message') blk.dec().println('}') end end end func Result if(linked("StringBuilder")) if(not linked("doCopyTo")) this.make_copy() end return(this.codename) end end func ToString if(linked("StringBuilder")) if(not linked("doCopyTo")) this.make_copy() end return(this.codename + '.ToString()') end end