func init // define project name sys.set_project(this.name) // initialize properties platform_target = this.props("Platform").value // defines using namespaces if(not isdef("Using")) arr = this.props("Using").value for(i = 0; i < arr.size(); i++) sys.add_use(code(arr.get(i))) end end // defines attributes if(not isdef("Attributes")) arr = this.props("Attributes").value this.attr = code(arr.join(',')) end // defines using interfaces if(not isdef("Interfaces")) arr = this.props("Interfaces").value this.interfaces = code(arr.join(',')) end // defines level this.level = isdef("AccessModifier") ? '' : lower(this.props("AccessModifier").value) + ' ' // defines class type t = this.props("TypeModifier").value this.type = ((t _and_ 1) ? 'abstract ' : '') + ((t _and_ 2) ? 'partial ' : '') + ((t _and_ 4) ? 'sealed ' : '') + ((t _and_ 8) ? 'static ' : '') + ((t _and_ 16) ? 'virtual ' : '') // defines class name this.cName = code(this.props("ClassName").value) // defines inherit class this.inherit = isdef("Parent") ? '' : ': ' + code(this.props("Parent").value) end func doStart() // add using namespaces sys.add_use('System') // add common references sys.reference_add('System') sys.reference_add('System.Core') sys.reference_add('System.Xml.Linq') sys.reference_add('System.Data.DataSetExtensions') sys.reference_add('Microsoft.CSharp') sys.reference_add('System.Data') sys.reference_add('System.Xml') // init all unlinked elements this.parent.initall() // create main unit blk = block.reggen() blk.copyhere(blk_using) .println() .println('namespace ', code(this.props("Namespace").value)) .println('{').inc() if(not blk_struct.empty()) blk.copyhere(blk_struct) .println() end // defines comments if(not isdef("Comment")) arr = this.props("Comment").value for(i=0; i < arr.size(); i++) blk.println('/// ', code(arr.get(i))) end end // declares class isdef("Attributes") ? '' : blk.println('[', attr, ']') blk.println(this.level, this.type, 'class ', this.cName, this.inherit, isdef("Interfaces") ? '' : (isdef("Parent") ? ': ' : ',') + this.interfaces) .println('{').inc() if(not blk_fields.empty()) blk.copyhere(blk_fields) .println() end if(not blk_vars.empty()) blk.copyhere(blk_vars) .println() end for(i=0; i < inits.size(); i++) blk.copyhere(inits.get(i)) end if(not blk_proc_imp.empty()) blk.copyhere(blk_proc_imp) .println() end blk.dec().println('}') .dec().println('}') .println('// Made by HiAsm Studio version ' + version) pname = code(project_name()) fname = pname + '.cs' blk.save(fname) blk = block.reg("result") blk.println('') .println('').inc() .println('').inc() .println('', this.props("Platform").value, '') .println('Library') .println('', namespace, '') .println('', pname, '') .println('v4.0') .println('', this.props("FileAligment").value, '') b = this.props("Constants").value arr = new array() if(b _and_ 1) arr.add('DEBUG') end if(b _and_ 2) arr.add('TRACE') end if(not isdef("Symbols")) blk.println('true') arr.add(code(this.props("Symbols").value)) end blk.println('', lower(this.props("DebugInfo").value), '') .println('', lower(this.props("Optimize").value), '') if(isdef("OuputPath")) blk.println('', code(project_dir()), '') else blk.println('', code(this.props("OutputPath").value), '') end blk.println('', arr.join(';'), '') if(not isdef("ErrorReport")) blk.println('', lower(this.props("ErrorReport").value), '') end blk.println('', this.props("WarningLevel").value, '') .println('', lower(this.props("Unsafe").value), '') if(not isdef("SuppressWarning")) blk.println('', code(this.props("SuppressWarning").value), '') end if(not isdef("TreatWarnings")) blk.println('true') end if(not isdef("WarningsAsErrors")) blk.println('', code(this.props("WarningsAsErrors").value), '') end blk.println('', lower(this.props("Serialization").value), '') if(not isdef("Language")) blk.println('', code(this.props("Language").value), '') end if(not isdef("CheckOverflow")) blk.println('true') end if(not isdef("NoStdLib")) blk.println('true') end blk.copyhere(blk_prop) .println('true') .println('', code(this.props("BaseAddress").value), '') .dec().println('') .println('').inc() .copyhere(blk_refs) .dec().println('') .println('').inc() .println('') .copyhere(blk_comp) .dec().println('') .copyhere(blk_resx) .println('').inc() .println('') .dec().println('') .println('') .dec().println('') end