func init // adds using namespace sys.add_use('System.IO') // initialize instance blk_vars.println('private MemoryStream ' + this.codename + ';') if(not isdef("Stream")) ver = split(version, '.') if(ver.get(0) == "4") sys.UseClass("ResourceLibrary") sys.LoadMethod("ResourceStream") sys.add_use('System.IO') sys.link_win32_resources() blk_init.println(this.codename, ' = new MemoryStream();') .println('GetStandardResourceStream("", ', this.props("Stream").value , ').CopyTo(', this.codename, ');') else sys.add_use('System.IO') sname = code(this.props("Stream").value) path = code_dir() && sname sys.resource_add(code(path), sname) blk_init.println(this.codename, ' = new MemoryStream();') .println('(Assembly.GetEntryAssembly().GetManifestResourceStream("', sname, '")).CopyTo(', this.codename, ');') end elseif(not isdef("FileName")) path = unescape(this.props("FileName").value) sname = 'stream' + this.id sys.resource_add(code(path), sname) blk_init.println(this.codename, ' = new MemoryStream();') .println('(Assembly.GetEntryAssembly().GetManifestResourceStream("', sname, '")).CopyTo(', this.codename, ');') else params = this.props('Constructor').value if(params == 'Constructor') params = '' elseif(params == 'Constructor2') params = '' + d("buffer") elseif(params == 'Constructor3') params = '' + d("capacity") elseif(params == 'Constructor4') params = '' + d("buffer") + ', ' + d("writable") elseif(params == 'Constructor5') params = '' + d("buffer") + ', ' + d("index") + ', ' + d("count") elseif(params == 'Constructor6') params = '' + d("buffer") + ', ' + d("index") + ', ' + d("count") + ', ' + d("writable") elseif(params == 'Constructor7') params = '' + d("buffer") + ', ' + d("index") + ', ' + d("count") + ', ' + d("writable") + ', ' + d("publiclyVisible") end blk_init.println(this.codename, ' = new MemoryStream(', params, ');') end blk_init.println(this.codename, '.Position = 0;') // initialize properties sys.set_typed_field(1, 'Capacity') sys.set_typed_field(105, 'Position') // makes implementation methods for properties sys._prop_init('CanRead', 1, 0, 104) sys._prop_init('CanSeek', 1, 0, 104) sys._prop_init('CanWrite', 1, 0, 104) sys._prop_init('.Capacity', 1, 1, 1) sys._prop_init('Length', 1, 0, 105) sys._prop_init('.Position', 1, 1, 105) // makes implementation of methods as properties sys._mtd_as_prop_init('GetBuffer()') sys._mtd_as_prop_init('ReadByte()') sys._mtd_as_prop_init('ToArray()') sys._mtd_as_prop_init('MemoryStream') end func doConstructor() blk.println(this.codename, ' = new MemoryStream();') this.set_props() end func doConstructor2(data) blk.println(this.codename, ' = new MemoryStream(', d("buffer"), ');') this.set_props() end func doConstructor3(data) blk.println(this.codename, ' = new MemoryStream(', d("capacity"), ');') this.set_props() end func doConstructor4(data) blk.println(this.codename, ' = new MemoryStream(', d("buffer"), ', ', d("writable"), ');') this.set_props() end func doConstructor5(data) blk.println(this.codename, ' = new MemoryStream(', d("buffer"), ', ', d("index"), ', ', d("count"), ');') this.set_props() end func doConstructor6(data) blk.println(this.codename, ' = new MemoryStream(', d("buffer"), ', ', d("index"), ', ', d("count"), ', ', d("writable"), ');') this.set_props() end func doConstructor7(data) blk.println(this.codename, ' = new MemoryStream(', d("buffer"), ', ', d("index"), ', ', d("count"), ', ', d("writable"), ', ', d("publiclyVisible"), ');') this.set_props() end func set_props() sys.set_typed_field(1, 'Capacity', '', '', '', blk) sys.set_typed_field(105, 'Position', '', '', '', blk) end